DECLARE @cols VARCHAR (MAX) SELECT @cols = COALESCE (@cols + ',[' + [Name] + '] INT', '[' + [Name] + '] INT') FROM CaseTypeMaster Select @cols then display below result [Employee Related] INT,[Customer Related] INT,[HR Related] INT,[Grievance Redressal] INT which i want to insert dynamically into temptable parameter DECLARE @TempTable AS TABLE ([Employee Related] INT,[Customer Related] INT,[HR Related] INT,[Grievance Redressal] INT) DECLARE @TempTable AS TABLE (@cols) It is possible or not ?
INSERT INTO @TempTable (columnName) SELECT * FROM @cols
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)