Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 3rd, 2008, 12:08 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using multiple SPs in one "Execute SQL Task"

I have some (say, 3) stored procedures, and they all have the same one parameter. Each SP returns a dataset. I need to import each dataset to a table using DTS.

So, I created an "Execute SQL Task" and typed in "SQL Statement" something like this:

INSERT INTO TABLE TABLE1
EXEC SP1 ?
GO
INSERT INTO TABLE TABLE2
EXEC SP2 ?
GO
INSERT INTO TABLE TABLE3
EXEC SP3 ?
GO

And the execution return an error: No value given for one or more required parameters.

Is it possible to assign a parameter to all three SPs?

  #2 (permalink)  
Old January 3rd, 2008, 12:17 AM
Friend of Wrox
 
Join Date: Oct 2007
Location: , , .
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

Solution.

INSERT INTO TABLE TABLE1
EXEC SP1 @sp1para=1
GO


INSERT INTO TABLE TABLE2
EXEC SP2 @sp2param=1
GO


INSERT INTO TABLE TABLE3
EXEC SP3 @sp3param=1
GO

I you use go statement once in the end. then you can do following
DECLARE @VALUE INTEGER
SET @VALUE=1

INSERT INTO TABLE TABLE1
EXEC SP1 @sp1para=@VALUE

INSERT INTO TABLE TABLE2
EXEC SP2 @sp2param=@VALUE

INSERT INTO TABLE TABLE3
EXEC SP3 @sp3param=@VALUE
GO


urt
  #3 (permalink)  
Old January 3rd, 2008, 12:53 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply urt.

The actual value of the parameter comes from a global variable of the DTS package. So I changed the SQL statement as follow:

DECLARE @VALUE INTEGER
SET @VALUE=?

INSERT INTO TABLE TABLE1
EXEC SP1 @sp1para=@VALUE

INSERT INTO TABLE TABLE2
EXEC SP2 @sp2param=@VALUE

INSERT INTO TABLE TABLE3
EXEC SP3 @sp3param=@VALUE
GO

It's working!

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deployment - Execute Package task carumuga SQL Server DTS 0 October 3rd, 2008 07:43 AM
execute xl macro in DTS 2000 activex script task ismailc SQL Server DTS 1 December 14th, 2007 10:14 AM
Running DTS package through Execute SQL / pkg Task sthekk SQL Server DTS 1 April 23rd, 2007 11:18 AM
Execute multiple Biztalk 2004 messages from .NET pankaj.mittal Biztalk 0 June 7th, 2006 09:56 AM
Execute Task from ActiveX Script Task PorcupineRabbit SQL Server DTS 1 January 10th, 2006 12:37 PM



All times are GMT -4. The time now is 05:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.