cheek1e
asked on
SQLServer 7 DTS calling from proc
So I have a DTS package which works fine from Enterprise Manager. I am trying to call from a stored proc. It all seems to execute ok (no return errors) but the package is not executing.
All permissions and file locations are fine. I've stripped the proc code down to this and running in QueryAnalyser which is also not executing...
DECLARE @errDesc VARCHAR(1000)
exec master.dbo.sp_OACreate 'DTS.Package', @objPackage OUTPUT
exec master.dbo.sp_OAMethod @objPackage, 'LoadFromSQLServer' , null, @ServerName = 'VME44WS45', @Flags = 256, @PackageName = 'DTS__PLclosesIn'
exec master.dbo.sp_OAMethod @objPackage, 'Execute'
exec master.dbo.sp_OAMethod @objPackage, 'Uninitialize'
exec master.dbo.sp_OADestroy @objPackage
Any ideas?
Thanks,
S
All permissions and file locations are fine. I've stripped the proc code down to this and running in QueryAnalyser which is also not executing...
DECLARE @errDesc VARCHAR(1000)
exec master.dbo.sp_OACreate 'DTS.Package', @objPackage OUTPUT
exec master.dbo.sp_OAMethod @objPackage, 'LoadFromSQLServer' , null, @ServerName = 'VME44WS45', @Flags = 256, @PackageName = 'DTS__PLclosesIn'
exec master.dbo.sp_OAMethod @objPackage, 'Execute'
exec master.dbo.sp_OAMethod @objPackage, 'Uninitialize'
exec master.dbo.sp_OADestroy @objPackage
Any ideas?
Thanks,
S
This is kind of a lousy method of doing it.
Why don't you just use XP_CMDSHELL and DTSRUN to execute the package????
Why don't you just use XP_CMDSHELL and DTSRUN to execute the package????
ASKER
I need to call a different package depending on parameters sent to the stored proc.
Can I still do this with xp_cmdshell?
Can I still do this with xp_cmdshell?
ASKER
OK I can execute the DTS with xp_cmdshell but am getting an error:
Error string: Error opening datafile: Access is denied.
I'm in QueryAnalyser logged in as sa (as would be in EM - where the file is accessed), and running the command with /E
Nearly there!
Error string: Error opening datafile: Access is denied.
I'm in QueryAnalyser logged in as sa (as would be in EM - where the file is accessed), and running the command with /E
Nearly there!
ASKER
All sorted now.
Had to change the SQL server startup account.
Had to change the SQL server startup account.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yep it works gloriously now :-)
i guess this thread should be closed...
i guess this thread should be closed...
yep....
try putting your loadfromsqlserver command into a string first with all the required variables and then executing it - this always works for me
eg:
declare @cmd varchar(500), @objPackage int
SET @Cmd = 'LoadFromSQLServer("VME44W
exec master.dbo.sp_OACreate 'DTS.Package', @objPackage OUTPUT
exec master.dbo.sp_OAMethod @objPackage, @Cmd, NULL
exec master.dbo.sp_OAMethod @objPackage, 'Execute'
enjoy