Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamically Assign Table Name
Message
 
 
To
08/07/2002 08:31:41
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00676071
Message ID:
00676085
Views:
18
>Hi,
>
>I would like to dynamically create a table in a stored procedure based on a value that I have stored in a variable..
>

Here's a sample code that creates table in the current DB.
declare @TableName varchar(32)
SET @TableName = 'TestTable'
EXECUTE('CREATE TABLE ' + @TableName + 
	' (field1 char(3), field2 int)')
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform