Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Saving DTS Package as VB Progrmatically

Author  Topic 

syedrehman
Starting Member

7 Posts

Posted - 2004-09-15 : 18:42:22
Hello All:

I need to export several dozen DTS packages from SQL Server 2000 into Visual Basic File(s). I can open each package, select "Save As" and then select "Visual Basic File" as the output location. I can also use dtsrun and dump the DTS package out to a "DTS" file. Does anyone know how to programatically export multiple DTS packages as "Visual Basic File"?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-09-15 : 18:44:01
http://www.nigelrivett.net/SaveAllDTSPackagesToFiles.html

Tara
Go to Top of Page

syedrehman
Starting Member

7 Posts

Posted - 2004-09-15 : 18:52:56
A good article! However, that code will write the package out as ".DTS" I need to write the packages out as ".VBS"

I can save them as "VBS" if I open the package up. But not from code. I need to save the package as VBS so I can make some global changes and then re-load the packages to SQL.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-09-15 : 19:04:01
I have a feeling that you make a small change to Nigel's code to get it to save to a VB file. Not sure though.

Tara
Go to Top of Page

syedrehman
Starting Member

7 Posts

Posted - 2004-09-15 : 19:10:26
Tried that already. The file has an extension of VBS but the insides are all still binary. When I export the file as VBS from the DTS package it gets written out as plain text. I thought there might be a "switch" that I could provide to the exporting function but have not found any so far.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-09-15 : 19:13:36
This line:
exec @rc = sp_OAMethod @objPackage, 'SaveToStorageFile', null, @FileName

probably can be modified to do what you want. The SaveToStorageFile probably can be changed, not sure to what though. Maybe Nigel will be able to help. His userid here is nr.


Tara
Go to Top of Page
   

- Advertisement -