?
Solved

SQLServer 7 DTS calling from proc

Posted on 2003-10-22
10
Medium Priority
?
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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 1400 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

770 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