Hi. As part of a daily process I have to copy files from various locations into a single folder. I use different columns of different tables to determine my path, filenames, etc. I usually run this:
Then copy/paste the results into a batch file and run it manually. I am hoping to just incorporation this into a script. I tried something like this:
But I get the message Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Do I need to use a WHILE loop to just copy one at a time or is there an easier way to have SQL do this with xp_cmdshell?
Thanks!
Code:
select 'copy "\\disk01\images06\not converted\january 2000 - April 2013\' + path + '\' + tifname + '" "\\disk01\images0\converted\' + basename + '.' + pages + '"'
from #tempimagemerge
Then copy/paste the results into a batch file and run it manually. I am hoping to just incorporation this into a script. I tried something like this:
Code:
declare @copyscript varchar(1000)
set @copyscript = (select 'copy "\\disk01\images06\not converted\january 2000 - April 2013\' + path + '\' + tifname + '" "\\disk01\images0\converted\' + basename + '.' + pages + '"'
from #tempimagemerge)
master..xp_cmdshell @copyscript
But I get the message Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Do I need to use a WHILE loop to just copy one at a time or is there an easier way to have SQL do this with xp_cmdshell?
Thanks!