Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Table

Status
Not open for further replies.

VBXL

Programmer
Joined
Jul 10, 2001
Messages
198
Location
GB
How do you create a table dynamically

i.e

Create table @tablename


Cheers

VBXL
 

declare @sql nvarchar(2000)

set @sql='Create Table ' + @tablname + (col1 datatype, col2 datatype, ...)'

exec(@sql) Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 

I noted a missing quote after submitting.

set @sql='Create Table ' + @tablname + '(col1 datatype, col2 datatype, ...)'
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top