I'm missing something

Posted by Redi on Stack Overflow See other posts from Stack Overflow or by Redi
Published on 2010-04-07T11:23:35Z Indexed on 2010/04/07 11:33 UTC
Read the original article Hit count: 471

Filed under:
|
declare @servername varchar(2000)
set @EmriServerit=(select @@servername)
declare @dbname varchar(2000)
set @dbname ='Test1'
declare @Dir varchar(2000)
set @Dir='F:\dataclient.sql'

exec master.dbo.xp_cmdshell 'osql -E -S ' + @servername+ ' -d ' + 
    @dbname +' -i ' + @Dir

It gives me and error: "incorrect sysntax near +"

If i don't use variables it works ok. What am i missing! Thanks in advance

© Stack Overflow or respective owner

Related posts about xp-cmdshell

Related posts about sql-server