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)
 Creating a MDB file within a DTS package

Author  Topic 

Zathras
Starting Member

28 Posts

Posted - 2004-06-14 : 16:52:24
I'm using the DTS graphical package creator withing SQL Server 2000 Client Tools to create a DTS package. I have two connection objects: 1 to the SQL Server, and 1 to a MDB file. The location of the MDB file is updated by the Dynamic Properties object and set to a global variable "Location" (That way I can vary where I want my MDB file to be created at).

But how do I actually create a blank MDB file at the location specified in the package's global variable from within the DTS package?

Thanks!
-Mike

(The purpose of the DTS package is to export data about a certain project to the local user's drive for custom reporting through Access)

Zathras
Starting Member

28 Posts

Posted - 2004-06-14 : 21:02:00
Sometimes it's nice to answer your own question....

You can create a ActiveX Script Task with the following (uses a DTS global parameter):

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim cat
Dim strSQL
Set cat=CreateObject("ADOX.Catalog")
strSQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DTSGlobalVariables("FileLocation").Value
cat.Create(strSQL)
Main = DTSTaskExecResult_Success
End Function
Go to Top of Page
   

- Advertisement -