I have a database whose name is Backup.

  • I have a database whose name is Backup.
    When I am running backup maintenance plan first time its failing and I have applied for retry in job ,and for next  run its getting successful.
    I want to know the reason.

    Thanks

  • What error message are you getting if you check the history of the job?

    Thanks

  • Sorry its Update statistics operation not backup operation:

    Error:

    If Object_..." failed with the following error: "156 Incorrect syntax near the keyword 'BACKUP'.
    156 Incorrect syntax near the keyword 'BACKUP'.
    156 Incorrect syntax near the keyword 'BACKUP'.

    Thanks

  • forsqlserver - Thursday, January 31, 2019 1:40 AM

    Sorry its Update statistics operation not backup operation:

    Error:

    If Object_..." failed with the following error: "156 Incorrect syntax near the keyword 'BACKUP'.
    156 Incorrect syntax near the keyword 'BACKUP'.
    156 Incorrect syntax near the keyword 'BACKUP'.

    It must be doing a backup if it's got the keyword 'BACKUP'. Have you tried running it as a SQL Agent job to check if it fails?

    Thanks

  • What's the statement your using? BACKUP is a reserved word in SQL Server, so it's a poor choice for an object's name, in truth. The errors suggests you aren't quoting the objects name (hence why "incorrect syntax near the keyword 'BACKUP'"). This, of course, is a guess. We have a but a sliver of a piece of the pie at the moment.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Sounds like Rob Volk's awesome presentation, Revenge, The SQL.

    Anyway, you need brackets on your database names in the code. It'll have to go into the backup script for everything.

    Strong piece of advice. Never use reserved words, special characters, or emojis, as object names within SQL Server.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks all but its created by client mistakenly.I want to know how update stats is failing in first run and executing successfully in second run?

    Thanks

  • forsqlserver - Thursday, January 31, 2019 8:41 PM

    Thanks all but its created by client mistakenly.I want to know how update stats is failing in first run and executing successfully in second run?

    We still that SQL please.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 8 posts - 1 through 7 (of 7 total)

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