[SQLSTATE 42000] on backup.

  • Hello folks,

    I am currently creating SQL backups for our SharePoint installation in SQL 2005 SP2, it all works fine until it hits the admin content databases. The database names for the admin content contain hyphens, not really a problem so I use the following code:

    backup database "SharePoint_AdminContent_26931d2b-2bf2-4264-bd64-83d58784f44b" to SharePoint_AdminContent_2_Mon with init

    The code works fine through database engine query and the database backs up, if i put it in as a step in a SQL Server Agent Job then the job fails with:

    Message

    Executed as user: xx\xxxxxxxx. Incorrect syntax near 'SharePoint_AdminContent_26931d2b-2bf2-4264-bd64-83d58784f44b'. [SQLSTATE 42000] (Error 102) Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon. [SQLSTATE 42000] (Error 319). The step failed.

    I have read that it may be a bug with SQL 2005, does anyone know if this has been confirmed or if there is a solution?

    Thanks in advance.

    Simon

  • They are syntax errors from my point of view. Try to use [] to enclose your database name, and see what will happen.

  • Thanks, that worked for me.

    I had assumed the syntax was correct as the code worked fine within query analyazer.

    Thanks again for the help.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply