Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQLServer 7 DTS calling from proc

Posted on 2003-10-22
10
Medium Priority
?
272 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

636 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