Hi,
We are taking backups for different databases in the same folder with date and time.I am copying those backups to other server,in that
I want to rename those backups without date and time format for other purpose.
can i get any syntax using xp_cmd_shell.
Pls find the following code and give me your advice.
declare @currentFolderP ath varchar(256)
declare @command varchar(1000)
declare @result varchar(1000)
declare @dbname sysname
declare @destinationfol der varchar(1000)
declare @output varchar(1000)
set @currentFolderP ath=' E:\TEST4\'
set @destinationfol der=@currentfol derpath + '\*.* ' + '.BAK'
set @dbname='abc'
set @output=@curren tFolderPath + @dbname + '.BAK'
SET @command = 'RENAME ' + @destinationfol der + @output
print @command
EXEC @result = XP_CMDSHELL @command, NO_OUTPUT
for this code the output is::: RENAME E:\TEST4\\*.* .BAK E:\TEST4\abc.BA K
We are taking backups for different databases in the same folder with date and time.I am copying those backups to other server,in that
I want to rename those backups without date and time format for other purpose.
can i get any syntax using xp_cmd_shell.
Pls find the following code and give me your advice.
declare @currentFolderP ath varchar(256)
declare @command varchar(1000)
declare @result varchar(1000)
declare @dbname sysname
declare @destinationfol der varchar(1000)
declare @output varchar(1000)
set @currentFolderP ath=' E:\TEST4\'
set @destinationfol der=@currentfol derpath + '\*.* ' + '.BAK'
set @dbname='abc'
set @output=@curren tFolderPath + @dbname + '.BAK'
SET @command = 'RENAME ' + @destinationfol der + @output
print @command
EXEC @result = XP_CMDSHELL @command, NO_OUTPUT
for this code the output is::: RENAME E:\TEST4\\*.* .BAK E:\TEST4\abc.BA K