Technical Article

Remove old DTS Package versions

,

This Procedure is what I use to clean out all the old DTS package version on my server periodically. You just place it in the msdb database and run it as you need to.

Note: Although I have never had an issue with it, I do suggest backup msdb database beforehand, just in case you wack a version and realize later you didn't want to do it.

CREATE PROCEDURE ip_RemoveOldDTSVersions
AS

-- SET NOCOUNT ON -- I like to know how many items removed.
delete 
	sysdtspackages
where
	versionid in (
		select 
			versionid 
		from 
			sysdtspackages
		inner join
			(
				select 
					[id] mxid, 
					max(createdate) as mxcd 
				from 
					sysdtspackages 
				group by 
					[id]
			) as MaxCD
		on
			[id] = mxid and
			createdate != mxcd
	)go

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating