Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 March 29th, 2004, 09:26 AM
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Pass though parameters to stored procedures

Hello,

How are you today?

I need to pass parameters from an Access front end form to a Stored Procedure. I found a method of doing this:

http://p2p.wrox.com/post.asp?method=Topic&FORUM_ID=5

My challenge is that the stored procedure is not called directly, instead I use this query:

SELECT regionorder, Regions3, 1 As Quarter, January as A, February as B, March as C FROM RegionofResidenceCrosstab
UNION ALL
SELECT regionorder, Regions3, 2 As Quarter, April, May, June FROM RegionofResidenceCrosstab
UNION ALL
SELECT regionorder, Regions3, 3 As Quarter, July, August, September FROM RegionofResidenceCrosstab
UNION ALL SELECT regionorder, Regions3, 4 As Quarter, October, November, December FROM RegionofResidenceCrosstab;

and the Union query then calls the crosstab query which needs the parameters that are passed. Can a stored procedure call another stored procedure and pass parameters to it, and if so, how can this be done?
 
Old March 29th, 2004, 10:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

A stored procedure can call another stored procedure, such as:

set @rs = exec newsp @param1, @param2, ... etc

The exec method executes stored procedures within the stored procedures.
 
Old March 29th, 2004, 10:31 AM
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Thanks for the response.

Not sure how/if I can exec and pass parameters using Union. Remember RegionofResidenceCrosstab is my stored procedure.

Or to ask a different way, can I select from the results of a stored procedure?
 
Old March 29th, 2004, 02:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You may be able to select the results of the SP, or do:

set @rs = exec new sp ...

select ..., @rs... etc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
the SQL stored procedures BenCh BOOK: ASP.NET Website Programming Problem-Design-Solution 0 March 11th, 2005 04:18 PM
Calling Stored procedures with out parameters bansalh Access 1 November 25th, 2003 04:30 PM
Pass-through queries vs stored procedures kendawg Access 2 October 8th, 2003 02:00 AM
in-line parameters in stored procedures itekcorp ADO.NET 0 July 12th, 2003 09:57 PM





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