Solved

SQLServer 7 DTS calling from proc

Posted on 2003-10-22
10
265 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now