all groups > sql server dts > october 2006 >
You're in the

sql server dts

group:

error in sql


error in sql SimplySuzy
10/5/2006 8:07:56 AM
sql server dts:
Can someone please help me with this syntax error. the single and
double quotes always get me turned around.
I am trying to create a table with a dynamic name set by a global
variable in a dts package

here is me code

Declare @DB varchar(25)
set @DB = 'nfsntest1'
Declare @Tablename varchar(50)
set @TableName ='test'
Declare @sSQL varchar(8000)
set @sSQL = 'Create table ' + @DB + '.dbo.' + @TableName + '
([clmnt_idno] varchar (255) NULL )'
exec @sSQL

this is the error I get from DTS or query analyzer

Server: Msg 203, Level 16, State 2, Line 13
The name 'Create table nfsntest1.dbo.test ([c

it seems to be trying to find the sql statement instead of running it.
I can't place it in a stored procedure as it needs to be dynamic over
300 + databases

Any help is greatly appreciated.
Suzy
Re: error in sql SimplySuzy
10/5/2006 8:15:17 AM
Never mind I figured it out

[quoted text, click to view]
AddThis Social Bookmark Button