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