I have the following script to make a backup to my database:
declare @fecha varchar(MAX)
declare @archivo varchar(MAX)
set @fecha = SUBSTRING(Convert(Varchar(10), GetDate(),105),1,2)+SUBSTRING(Convert(Varchar(10), GetDate(),105),4,2)+SUBSTRING(Convert(Varchar(10), GetDate(),105),7,4)+'_'+SUBSTRING(CONVERT(Varchar(10), GetDate(),108),1,2)+SUBSTRING(CONVERT(Varchar(10), GetDate(),108),4,2)
set @archivo ='F:\GFE_Client'+@fecha+'.bak'
BACKUP DATABASE GFE-Client
TO DISK = @archivo
WITH FORMAT,
MEDIANAME = 'D_SQLServerBackups',
NAME = 'Full Backup of GFE-Client';
GO
The name of my database include a "-" and I can´t change this.
I have a way to replace the "-" in the script that does the backup?
Enclose your database name with brackets.
BACKUP DATABASE [GFE-Client]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.