Home Forums SQL Server 2008 SQL Server 2008 - General Cleanup History has an extra output message. Unable to understand how it is appearing. Please help RE: Cleanup History has an extra output message. Unable to understand how it is appearing. Please help

  • Ok, then just a suggestion to make your life easier especially since you're not recording the commands that get executed anywhere and you're not taking advantage of the safety of sp_ExecuteSQL...

    There's no difference between your method of...

    SELECT @CMD = 'EXEC msdb.dbo.sp_delete_backuphistory @oldest_date = ''' + @oldest_date + ''''

    EXEC (@cmd)

    ...and the method of ...

    EXEC msdb.dbo.sp_delete_backuphistory @oldest_date = @oldest_date

    ...except that your method is more complex, which makes it more subject to error, and more susceptible to SQL Injection attacks for any procs that do have parameters (this one admittedly doesn't).

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)