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)
 Error executing a DTS

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-01-03 : 09:47:17
Thomas writes "Hello,

I get an error if I wont to excecute a DTS-Package with an Sql-Statement.

This is my statement

Select * from OPENROWSET ('DTSPackageDSO','Usa /P /S /NDTS_NAME', 'Select *')

I get the message

Msg 7350, Level 16, State 2, Line 3
Could not get the column information from the OLE DB provider
'DTSPackageDSO'"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-01-03 : 10:42:34
It's not clear what you are trying to do, but whatever it is, it doesn't work that way.

How bout some more detail?

Jay White
{0}
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-03 : 12:37:35
Maybe you want this.

/* Running DTS FROM STORED PROCEDURE */

declare @objPackage int
declare @PackageName varchar(128)
declare @rc int
declare @ServerName varchar(128)
declare @DatabaseName varchar(128)
declare @FileName varchar(128)

select @PackageName = 'Data Import Package' ,
@ServerName = @@ServerName ,
@DatabaseName = db_name() ,
@FileName = '\\MyPC\InpFile\TestFile.txt'
exec sp_OACreate 'DTS.Package', @objPackage output
exec @rc = sp_OAMethod @objPackage, 'LoadFromSQLServer' , null, @ServerName = @ServerName, @Flags = 256, @PackageName = @PackageName
exec @rc = sp_OASetProperty @objPackage, 'GlobalVariables("ServerName").value', @ServerName
exec @rc = sp_OASetProperty @objPackage, 'GlobalVariables("DatabaseName").value', @DatabaseName
exec @rc = sp_OASetProperty @objPackage, 'GlobalVariables("FileName").value', @FileName
exec @rc = sp_OAMethod @objPackage, 'Execute'
exec @rc = sp_OADestroy @objPackage

Go to Top of Page
   

- Advertisement -