Sunday, March 25, 2012

database backups

Hi All
I creatred a service that backups all my databases to a file on the server.
My backup software will backup the files at night. I'm having problems
backing up databases who's names are all numbers (1234, 1211, .. etc). I can
backup the databases manually but my script will always fail. Do I have to
do anything special in T-sql to access a database whos name is all numbers?
Thanks
PhilTry enclosing the database name in brackets:
BACKUP DATABASE [1234]
TO DISK='\\SomeServer\SomeShare\1234.bak'
WITH INIT
BTW, you can make things easier by having database names confirm to the
rules for regular identifiers as described in the Books Online
<acdata.chm::/ac_8_con_03_6e9e.htm>.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Phillip D Edwards" <phil@.benesysinc.com> wrote in message
news:%23FuNKzseDHA.2464@.TK2MSFTNGP09.phx.gbl...
> Hi All
> I creatred a service that backups all my databases to a file on the
server.
> My backup software will backup the files at night. I'm having problems
> backing up databases who's names are all numbers (1234, 1211, .. etc).
I can
> backup the databases manually but my script will always fail. Do I
have to
> do anything special in T-sql to access a database whos name is all
numbers?
>
> Thanks
> Phil
>
>

No comments:

Post a Comment