sql2000 backup log to disk script needed

  • I need to backup my transaction logs to disk but I want to append the date time atleast to the minute but I am having problems getting by dealing with datetime and getdate().

    EX.

    log 1

    backup log dbase to disk = 'c:\dbase_transdump011508_1430'

    log2

    backup log dbase to disk = 'c:\dbase_transdump011508_1500'

    Any assistance would be helpful.

  • Declare a string, something like

    SET @SQL = "BACKUP LOG yourDB ...

    Execute the string, something like Exec ( @SQL)

  • Thanks however I am trying to append getdate to the end then do as you described. I am struggling with getdate(0) conversion I guess.

  • see if this helps

    declare @dumpdest char(100)

    declare @date varchar(20)

    select @date = convert(varchar,getdate(),112) + convert(varchar,getdate(),108)

    select @date = stuff(@date,charindex(':',@date),1,'_')

    select @date = stuff(@date,charindex(':',@date),1,'_')

    set @dumpdest = 'c:\junk\db1_' + @date + '.tdmp'

    backup log db1 to disk = @dumpdest with init

    go

    declare @dumpdest char(100)

    declare @date varchar(20)

    select @date = convert(varchar,getdate(),112) + convert(varchar,getdate(),108)

    select @date = stuff(@date,charindex(':',@date),1,'_')

    select @date = stuff(@date,charindex(':',@date),1,'_')

    set @dumpdest = 'c:\junk\db2_' + @date + '.tdmp'

    backup log db2 to disk = @dumpdest

    go

  • In the backup section, there are lots of scripts to do this.

  • 71 camaro (1/16/2008)


    Thanks however I am trying to append getdate to the end then do as you described. I am struggling with getdate(0) conversion I guess.

    I mean you attach the content from GETDATA() function, then attache it to the @SQL variable.

    Hopefully, it helps.

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

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