Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help: Can't backup database with " - " character in the database name

Status
Not open for further replies.

sunt

MIS
Nov 6, 2002
29
US
Hi Expert,
I tried to dump a SQL 7.0 database to a remote share using:
BACKUP DATABASE COLD-SYSTEM TO DISK='\\SERVER1\BACKUP\COLD.BAK'
However, when I executed the command. It gave me that :
Incorrect syntax near '-'

I have tried another database name with no '-' eg. pubs. It works fine and can dump to remote share.
I also checked the sysdatabases table and it does contain the database COLD-SYSTEM.
Is my command wrong or the backup command can't handle '-' character? I also tried the dump command, result the same.

Your help is appreciated.
Thanks
Sunt
 
Enclose the database name in brackets like so:
BACKUP DATABASE [COLD-SYSTEM] TO DISK='\\SERVER1\BACKUP\COLD.BAK'
 
Hi RobertT687,

It is working!
Thanks a lot!
Sunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top