Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Unusual Backup Problem

Author  Topic 

ryvalry
Starting Member

3 Posts

Posted - 2006-06-27 : 10:35:04
Hi all, my first time so please bare with me.

I'm doing a simple backup command - BACKUP DATABASE database name TO DISK = 'c:backup\databasename.bak'

There are seven databases that need to be backed up. Six work fine but the seventh is a problem because the database name is made up of several words with spaces inbetween - eg. end of may backup instead of end_of_may_backup.

How can I get the statement to work on the seventh database? Any help would be appreciated.

nosepicker
Constraint Violating Yak Guru

366 Posts

Posted - 2006-06-27 : 13:12:56
You should be able to have spaces in your backup file name (I just tested it successfully myself). What error message(s) are you getting?
Go to Top of Page

ryvalry
Starting Member

3 Posts

Posted - 2006-06-27 : 13:42:48
Thanks for testing it.

The message dialog box that pops up when I try to apply the job step says, "The Server detected the following syntax errors in the command: Error 170: Line 1: Incorrect syntax near 'BACKUP'. Are you sure this is what you want?"

Keep in mind that 'BACKUP' is last word in the database name.

If I go ahead and run it, the log simply says, "The job failed. The job was invoked by Schedule 74 (Backup End of May Backup). The last step to run was step 1 (Backup locally)."
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-06-27 : 13:44:47
[database name]

Edit: use the [] around the db name.

rockmoose
Go to Top of Page

ryvalry
Starting Member

3 Posts

Posted - 2006-06-27 : 13:52:55
I could sit here and tell you til I'm blue in the face that I had tried the brackets already, but you wouldn't believe me - and rightly so.

Thank you EVER SO MUCH!!! It worked.

You all may have strange names, but you sure are smart.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-06-27 : 17:06:39
"You all may have strange names, but you sure are smart."
Oh you must mean the other guy
That handle really makes me smile :)

rockmoose
Go to Top of Page

nosepicker
Constraint Violating Yak Guru

366 Posts

Posted - 2006-06-27 : 21:07:53
To clarify, I'm the one with the strange name, and the "other guy" is the one who's smart :) I should've read the original post more carefully to see that the database had the spaces, not the datafile. D'oh!
Go to Top of Page
   

- Advertisement -