|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
concatenationcould you give me a dig out with this concatenation, it's driving me nuts
declare @ev_bat_desc varchar(50), @text varchar(100) select @ev_bat_desc = 'CQA_cmdmgr_Marc.bat' -- select 'c:\psexec \\10.2.27.230 -I ' + @ev_bat_desc + ' ;' -- emulate Exec master..xp_cmdshell 'c:\psexec \\10.2.27.230 -I' + @ev_bat_desc + ' ;' -- works Exec master..xp_cmdshell 'c:\psexec \\10.2.27.230 -I CQA_cmdmgr_Marc.bat' ; Check whether this works
Exec master..xp_cmdshell 'c:\psexec \\10.2.27.230 -I @ev_bat_desc ' Best Regards Vadivel http://vadivel.blogspot.com http://thinkingms.com/vadivel Show quote "marcmc" wrote: > could you give me a dig out with this concatenation, it's driving me nuts > > declare @ev_bat_desc varchar(50), @text varchar(100) > select @ev_bat_desc = 'CQA_cmdmgr_Marc.bat' > -- select 'c:\psexec \\10.2.27.230 -I ' + @ev_bat_desc + ' ;' > -- emulate > Exec master..xp_cmdshell 'c:\psexec \\10.2.27.230 -I' + @ev_bat_desc + ' ;' > -- works > Exec master..xp_cmdshell 'c:\psexec \\10.2.27.230 -I CQA_cmdmgr_Marc.bat' ; Hi, no it just gives me the parameters/functions list for the psExec app.
If I build up the string into one variable eg @text = 'c:\psexec \\10.2.27.230 -I ' + @ev_bat_desc + ' ;' Exec master..xp_cmdshell @text it will work. It means a lot more arsing around re: parameterisation but it seems a bit silly that its can't build its string in the Exec Stmt. |
|||||||||||||||||||||||