January 12, 2009 at 1:24 pm
How to use backup and restore script if the database name has a space
eg: database name : A B C
backup database A B C to disk ='D:\backup\A B C.bak' with init,stats
restore database A B C from disk = 'D:\backup\A B C.bak'
are both failing because of this. I don't want to use enterprise manager.
Kindly help in fixing this.
M&M
January 12, 2009 at 1:32 pm
Use quotes around the file path.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
January 12, 2009 at 1:35 pm
restore database [A B C] from disk = 'D:\backup\A B C.bak'
January 12, 2009 at 2:19 pm
BACKUP DATABASE [A B C] TO DISK = N'D:\backup\A B C.bak'
WITH NOFORMAT, NOINIT, NAME = N'A B C-Full Database Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
RESTORE DATABASE [A B C] FROM DISK = N'D:\backup\A B C.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
GO
SQL DBA.
January 12, 2009 at 2:24 pm
Thank you all for the details. 🙂
M&M
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply