I am trying to take database backup. How can I do that when getdate is being appended with file name with format d开发者_如何学运维d/mm/yyyy.
declare @dbName VARCHAR(100)
declare @path VARCHAR(100)
set @dbName='CallMeIndia'
set @path='F:\'+@dbName +'-'+convert(varchar(50),getdate(),103)+'.bak'
BACKUP DATABASE @dbName
TO DISK= @path
@Shantanu, a file can't include the /
char in the name , try using another format, something like yyyymmdd (112) , you can check this link for more formats.
set @path='F:\'+@dbName +'-'+convert(varchar(50),getdate(),112)+'.bak'
精彩评论