Hi there
Is there any way to create a table in a stored procedure dynamically where the table name is based on a variable?
I did something as follows but it does not work.
Declare @sql varchar(255)
Declare @table_name varchar(30)
Select @table_name = 'my_table_01_2001'
Select @sql = 'create table ' + @table_name
+ ' (column_1 int primary key)'
Exec(@sql)
Please help.
Ricky
Is there any way to create a table in a stored procedure dynamically where the table name is based on a variable?
I did something as follows but it does not work.
Declare @sql varchar(255)
Declare @table_name varchar(30)
Select @table_name = 'my_table_01_2001'
Select @sql = 'create table ' + @table_name
+ ' (column_1 int primary key)'
Exec(@sql)
Please help.
Ricky