Taking Database backup: How to skip '/' from getdate so that it is not considered to be in a folder

Posted by Shantanu Gupta on Stack Overflow See other posts from Stack Overflow or by Shantanu Gupta
Published on 2010-04-21T06:41:43Z Indexed on 2010/04/21 6:53 UTC
Read the original article Hit count: 163

I am trying to take database backup. How can I do that when getdate is being appended with file name with format dd/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 

© Stack Overflow or respective owner

Related posts about database

Related posts about database-backups