Retrieving SSIS packages from SQL Server

SSIS packages, when deployed in SQL Server, are stored in the MSDB database. This is a very simple query to retrieve the package definition from SQL Server MSDB database. You would obviously need permissions on MSDB database to run it.

SQL Server 2012 , SQL Server 2008, SQL Server 2008 R2

SELECT [Name] = pckg.[name]
     , [Description] = pckg.[description]
     , [CreatedDate] = pckg.[createdate]
     , [DisplayFolder] = pckgfolder.foldername
     , [PackageXML] = CAST(CAST(packagedata AS VARBINARY(max)) AS XML)
FROM [msdb].[dbo].[sysssispackages] pckg
INNER JOIN [msdb].[dbo].[sysssispackagefolders] pckgfolder
ON pckg.folderid = pckgfolder.folderid

SQL Server 2005

SELECT [Name] = pckg.[name]
     , [Description] = pckg.[description]
     , [CreatedDate] = pckg.[createdate]
     , [DisplayFolder] = pckgfolder.foldername
     , [PackageXML] = CAST(CAST(packagedata AS VARBINARY(max)) AS XML)
FROM [msdb].[dbo].[sysdtspackages90] pckg
INNER JOIN [msdb].[dbo].[sysdtspackagefolders90] pckgfolder
ON pckg.folderid = pckgfolder.folderid

Copy the PackageXML column value for the required package (or you can just click on it to open in new window), paste in any text editor and save as .dtsx file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s