Wrong filename syntax error...

  • A database has been created with a logical name hansjestest-0_Log. Note the line, NOT underscorde between ..test and 0. This name is accepted, seems to be correct. Now I wish to truncate the logfile and use this statement:

    BACKUP LOG hansjestest-0_Log

    WITH TRUNCATE_ONLY

    I get a syntax-error on the minus-sign:

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

    Line 1: Incorrect syntax near '-'.

    Several questions:

    - Is this an error or is this behaviour by design? Any1 encountered this before

    - When I go to the table sysaltfiles in MASTER I can change the NAME column for this file, however, can I be sure that now above statement will work correctly? Since this is a highly critical database in our production environment I am reluctant to try without knowing exactly what will happen. I am busy setting up a test situation, but that takes some doing. In the mean time we get a Log Full error 5 times a second and I like to stop that. No, I can't extend the partition; currently the log has only a few Mb data, it's empty but takes up almost all space of its partition.

    TIA,

    hans Brouwer

    Greetz,
    Hans Brouwer

  • Did you try using [] around the term with the '-' character in it? Pardon me if this is too simple a repl.

    Toni

  • Or fix it, using syntax like the following. Note the [] around the word with a reserved char.

    alter database mntrDevl

    MODIFY FILE (NAME = [mntrDevl-Log] , NEWNAME = mntrDevl_Log )

    Regards

    Karl

  • Just be sure there are no scripts, procedures views etc in relation to the old name if you want to rename it because it can cause the script, sp ,views etc. to fail.

    "-=Still Learning=-"

    Lester Policarpio

  • Tnx for answering all.

    I still am curious about the name being accepted on creation but rejected on changing.

    Greetz,
    Hans Brouwer

  • FreeHansje (1/21/2008)


    A database has been created with a logical name hansjestest-0_Log. Note the line, NOT underscorde between ..test and 0. This name is accepted, seems to be correct. Now I wish to truncate the logfile and use this statement:

    BACKUP LOG hansjestest-0_Log

    WITH TRUNCATE_ONLY

    I get a syntax-error on the minus-sign:

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

    Line 1: Incorrect syntax near '-'.

    Several questions:

    - Is this an error or is this behaviour by design? Any1 encountered this before

    - When I go to the table sysaltfiles in MASTER I can change the NAME column for this file, however, can I be sure that now above statement will work correctly? Since this is a highly critical database in our production environment I am reluctant to try without knowing exactly what will happen. I am busy setting up a test situation, but that takes some doing. In the mean time we get a Log Full error 5 times a second and I like to stop that. No, I can't extend the partition; currently the log has only a few Mb data, it's empty but takes up almost all space of its partition.

    TIA,

    hans Brouwer

    It is weird. Do you really use hansjestest-0_Log as your database name?

    BACKUP LOG databaseName ...

Viewing 6 posts - 1 through 5 (of 5 total)

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