Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2008, 12:08 AM
Registered User
 
Join Date: Jan 2008
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?

 
Old January 3rd, 2008, 12:17 AM
Friend of Wrox
 
Join Date: Oct 2007
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
 
Old January 3rd, 2008, 12:53 AM
Registered User
 
Join Date: Jan 2008
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!






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





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