Hi the code I have below is what I am using to rename a text file that I have.
This is working great once it is in the location
"D:\Microsoft SQL Server\SQLExport\KCC\"
I want it to now move to
"D:\Microsoft SQLServer\SQLExport\KCC\KCCExtract\ "
but the out put I am getting is 'IN2'
while in the last location I got the correct output of 'IN20090526.txt'
Any idea of what I am doing incorrect ????
@TodayDate as varchar(40),
@TodayHour as varchar(40),
@TodayMinu as varchar(40),
@NewFileName as varchar(100),
@cmdstr as varchar(128)
SELECT @TodayDate = CONVERT(VARCHAR(8), GETDATE(),112)
SELECT @NewFileName = 'IN' + @TodayDate + '.txt'
set @cmdstr= 'MOVE /Y "D:\Microsoft SQL Server\SQLExport\KCC\KCCExtract\inventory.txt"
"D:\Microsoft SQLServer\SQLExport\KCC\KCCExtract\ "'
EXEC master..xp_cmdshell @cmdstr