By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE #People(
[Name] [nvarchar](50) NOT NULL,
[Surname] [nvarchar](50) NOT NULL,
[StartDate] [datetime] NULL,
[EndDate] [datetime] NULL,
[Age] INT NULL,
[Weight] [decimal](5,2)
) ON [PRIMARY];
INSERT INTO #People
( [Name], [Surname], [StartDate], [EndDate], [Age], [Weight])
VALUES
('Mary', 'Green', '2021-07-01 00:00:00.000', '2021-07-01 14:00:00.000',35,87.4),
('Mary', 'Green', '2021-07-01 14:00:00.000', '2021-07-02 08:30:00.000',35,87.4),
('Mary', 'Green', '2021-07-03 00:00:00.000', '2021-07-03 08:00:00.000',35,87.4),
('Andrew', 'Green', '2021-07-02 08:30:00.000', '2021-07-03 08:45:00.000',40,62.8),
('Andrew', 'Green', '2021-07-03 08:45:00.000', '2021-07-03 09:00:00.000',40,62.8),
('Paul', 'Brown', '2021-07-04 06:00:00.000', '2021-07-04 09:00:00.000',18,82.1);
6 rows affected
SELECT * FROM #People
Name | Surname | StartDate | EndDate | Age | Weight |
---|---|---|---|---|---|
Mary | Green | 2021-07-01 00:00:00.000 | 2021-07-01 14:00:00.000 | 35 | 87.40 |
Mary | Green | 2021-07-01 14:00:00.000 | 2021-07-02 08:30:00.000 | 35 | 87.40 |
Mary | Green | 2021-07-03 00:00:00.000 | 2021-07-03 08:00:00.000 | 35 | 87.40 |
Andrew | Green | 2021-07-02 08:30:00.000 | 2021-07-03 08:45:00.000 | 40 | 62.80 |
Andrew | Green | 2021-07-03 08:45:00.000 | 2021-07-03 09:00:00.000 | 40 | 62.80 |
Paul | Brown | 2021-07-04 06:00:00.000 | 2021-07-04 09:00:00.000 | 18 | 82.10 |
select COLUMN_NAME from tempdb.INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME LIKE '#People%'
and DATA_TYPE NOT IN ('VARCHAR','CHAR','NVARCHAR','DATETIME','TIMESTAMP')
COLUMN_NAME |
---|
Age |
Weight |