Delete DTS package versions

  • Is there a way to delete the older versions of a DTS package via a script?

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • Yes. You would delete rows from msdb.dbo.sysdtspackagelog, either for a specific package or by age. I run this to delete logs that are older than 180 days:

    DELETE

    FROM sysdtspackagelog

    WHERE logdate <

    (SELECT DATEADD(day,-180,MAX(logdate))

    FROM sysdtspackagelog d

    WHERE id = d.id)

    Greg

  • Would you know why I cannot see the sysdtspackagelog table? If I run the following command:

    SELECT *

    FROM sysdtspackagelog

    I get a empty recordset back. I am using the SQL 2005 clients looking at a SQL 2000 server.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • Are you running the query in the msdb database of the SQL 2000 instance?

    Greg

  • Yes I am.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • Doh! My mistake. I should have told you to look at sysdtspackages rather than sysdtspackagelog. Notice that a new row is written every time a new package version is saved. Just delete rows where the createdate is older than the latest date for each package.

    Greg

  • Thanks alot that did it.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

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

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