LonniePurvis
Programmer
I have written a stored procedure that needs to create a temp table with variable column names and column numbers based upon entered parameters. I have some IF...THEN statements which SET a variable equal to a string that should create the table...
SET @DTData = 'CREATE TABLE #DTData( Tagname VarChar(32), TimeInState0Sec Real, StateChangeNo Int)'
I then try to execute the variable with:
Exec(@DTData)
It does NOT work. What am I doing wrong?
SET @DTData = 'CREATE TABLE #DTData( Tagname VarChar(32), TimeInState0Sec Real, StateChangeNo Int)'
I then try to execute the variable with:
Exec(@DTData)
It does NOT work. What am I doing wrong?