Hello... This is SQL 2000
I have a table LTIcddir with the following fields:
DOCUMENTNO, IMAGEID
2010020027, 1912901
2010020028, 1912902
2010020029, 1912903
I would like to rename the documentno.* files in a directory to imageid.*
I can use
to rename one file at a time, but I want to automate this script. Is there a way to do something like:
for each row in my table? I need to rename a few hundred files each day.
I also tried something like:
to use in my final rename statement, but this won't work becuase the subquery returned more than 1 value.
Thanks in advance!
I have a table LTIcddir with the following fields:
DOCUMENTNO, IMAGEID
2010020027, 1912901
2010020028, 1912902
2010020029, 1912903
I would like to rename the documentno.* files in a directory to imageid.*
I can use
Code:
exec master.dbo.xp_cmdshell 'rename c:\temp\2010020027.* 1912901.*
to rename one file at a time, but I want to automate this script. Is there a way to do something like:
Code:
EXEC master.dbo.xp_cmdshell 'rename c:\temp\' + documentno + '.* ' + imageid + '.*'
for each row in my table? I need to rename a few hundred files each day.
I also tried something like:
Code:
declare @docno varchar(75)
set @docno = (select documentno from lticddir)
Thanks in advance!