Backing up Transaction Log

  • I'm new to SQL so pardon my ignorance.......I am trying to dump my transaction log as it has grown excessively but I am not all that familiar with the syntax.  I know that database_name = the name of my db but what does @database_name_var = in the following syntax:

    BACKUP LOG { database_name | @database_name_var }

    {

        [ WITH

            { NO_LOG | TRUNCATE_ONLY } ]

    any help is appreciated.

  • It just means you can store your database name in a variable and pass that instead of passing the text of the database name.

     

    I usually just use the following syntax:

    backup log 'DBNAME' to disk = 'UNC path'

  • I always get confused when looking at some of the syntax in BOL, especially when you get braces and brackets all over the show. 

    Basically, anything contained within braces {} are required statements, but anything divided by the vertical line "|" means that you choose one of the items listed.  Therefore, in your case, you can choose to enter the database name, or you enter a variable name which references the database.  Anything within the square brackets [] are optional statements.

    Hope this helps.

  • Why don't you look at your other thread where you have some answers?

    And just stick to one post maybe?

    http://qa.sqlservercentral.com/forums/shwmessage.aspx?forumid=4&messageid=214965

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

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