Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

tsql create table with variable name

DECLARE @tableGUID uniqueidentifier;
SET @tableGUID = NEWID()  
DECLARE @DynamicSQL nvarchar(1000);
SET @DynamicSQL = N'SELECT * INTO ' + @tableGUID + ' FROM OtherTable';
EXEC(@DynamicSQL);
 
PREVIOUS NEXT
Tagged: #tsql #create #table #variable
ADD COMMENT
Topic
Name
1+2 =