How to upload legacy DTS Packages into a SQL Server 2005 server

By David Fekke's Blog at February 19, 2007 12:04
Filed Under:

I am working on project to migrate some existing DTS Packages that were created in SQL Server 2000 over to SQL Server 2005. I have been trying to use SQL SMO, which is the prefered Microsoft way to script and program SQL Server. SMO does have a way to import SSIS packages to SQL Server 2005, but it will not work with the older DTS packages.

Buck Woody at Microsoft pointed me in the right direction on how to get this working. SQL DMO is the old COM library for scripting and programming SQL Server. The SQL DMO library still works with SQL Server 2005. I created a C# app to import a SQL Server 2000 structured storage file into the 2005 server.

The first thing I did was add a reference for the Microsoft DTSPackage Object Library in the list of COM objects.

I then used the following code to import the DTS file into the SQL Server;

[code:c#]

string package = @"C:\DTSTest\ImportSample.dts";

object pVarPersistStgOfHost = null;

DTS.Package myPackage = new DTS.Package();

myPackage.LoadFromStorageFile(package, "", null, null, null, ref pVarPersistStgOfHost);

myPackage.SaveToSQLServer("10.25.15.0", null, null,

DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection,

null, null, null,

ref pVarPersistStgOfHost, false);

You will need to add some additional code to unmarshall DTS.Package object.

Comments

2/19/2007 6:15:38 PM #

Ryan

A while back I wrote up some instructions to call an MS SQL 2000 DTS package via CF.  I haven't had any luck doing the same with the new 2005 version of SQL.  Any luck calling the new DTS equivalent easily via CF (I had to use a stored proc in SQL to do it)?

Ryan United States

2/19/2007 6:49:19 PM #

David Fekke

We are using the same stored procedure to execute our DTS packages on SQL Server 2005. We use the sp_OACreate and sp_OAMethod extended stored procedures to accomplish this task.

Good Luck,
David.

David Fekke United States

6/25/2007 7:09:39 PM #

brad

Perhaps you can show an example of using  sp_OACreate and sp_OAMethod  for SQL Server 2005 to load from a physical dtsx file on the file system. Can't quite seem to get it working. Thanks!

brad United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading