Solved

SQLServer 7 DTS calling from proc

Posted on 2003-10-22
10
267 Views
Last Modified: 2008-03-03
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

0
Comment
Question by:cheek1e
  • 4
  • 3
10 Comments
 

Expert Comment

by:cherrypie
ID: 9599494
HI

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("VME44WS45", "", "", 256, "", , , "DTS__PLclosesIn")'
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
0
 
LVL 34

Expert Comment

by:arbert
ID: 9601924
This is kind of a lousy method of doing it.

Why don't you just use XP_CMDSHELL and DTSRUN to execute the package????
0
 

Author Comment

by:cheek1e
ID: 9604801
I need to call a different package depending on parameters sent to the stored proc.
Can I still do this with xp_cmdshell?

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:cheek1e
ID: 9604863
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!


0
 

Author Comment

by:cheek1e
ID: 9605210
All sorted now.

Had to change the SQL server startup account.
0
 
LVL 34

Accepted Solution

by:
arbert earned 350 total points
ID: 9606793
Yes, you should make sure the SQLServer account and the agent account startup with Domain admin accounts (if your're on a domain) or local admin accounts....

So did you get this to work?

Brett
0
 

Author Comment

by:cheek1e
ID: 9607380
yep it works gloriously now :-)

i guess this thread should be closed...
0
 
LVL 34

Expert Comment

by:arbert
ID: 9608648
yep....
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question