Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2011-12-14 : 05:10:03
|
| In the below sql, the error is on the first + sign before @sql.It says: Incorrect syntax near '+'.EXEC master..xp_cmdshell '''DTExec /f ' + @sql + ''the result show do the following:EXEC master..xp_cmdshell 'DTExec /f "D:\..."'Do you see what I am doing wrong please?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-14 : 05:11:11
|
this is enoughEXEC master..xp_cmdshell 'DTExec /f ' + @sql + '...' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2011-12-14 : 05:18:04
|
| I have this but still the same error.EXEC master..xp_cmdshell 'DTExec /f ' + @sql + ''Not sure what you mean by '...'Note that @sql is declared as nvarchar(1000)The @sql is set to something like "D:\path\..."Do you see the issue please?Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-14 : 05:19:06
|
| show the full command------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2011-12-14 : 05:37:56
|
| Solved by doing the following:set @param = 'DTExec /f ' + @sqlEXEC master..xp_cmdshell @param Thank you |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-14 : 05:49:51
|
| k------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|