"incorrect syntax near" when running "backup log ... "

  • Hi...

    Lack of knowledge led to transaction log full and system down.  trying to get back on track.  Got pointed in the direction of BACKUP LOG ...

    So, I try to run this :

    ...backup log horizon with truncate_only

    But, when I do it, I get this :

    ...Server: Msg 170, Level 15, State 1, Line 1

    ...Line 1: Incorrect syntax near 'horizon'.

    Also, Query Analyzer is set to show system functions in pink, and the word "log" is pink - so it seems QA isn't seeing "log" as a keyword.

    Anyone know how to make it behave?  I got a suggestion that the system could be in a backward compatibility mode that's causing this, but I don't know how to check the compatibility mode...

  • Assuming that horizon is your database name, the backup statement should work.

    The LOG word can play two roles: a clause of the BACKUP statement or a function (logarithm); Query Analyzer knows only the later, and that's why it colors it in pink.

    To check the compatibility mode, use:

    sp_dbcmptlevel horizon

    It should be 80 for SQL Server 2000. If it's lower, you can:

    a) set it to the latest version with:

    sp_dbcmptlevel horizon, 80

    (but should think why it was set to a lower version in the first time and whether that problem was solved or not)

    or:

    b) use the following instead of the backup statement:

    DUMP TRANSACTION horizon WITH TRUNCATE_ONLY

    or

    DUMP TRANSACTION horizon WITH NO_LOG

    (these are two different statements in an older syntax; I haven't tested them)

    Razvan

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

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