Wrox Programmer Forums
|
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 June 26th, 2003, 09:46 AM
Authorized User
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default parameters to sql

Hi,
What is the best way to handle situation in which number of paramters to a stored procedure or sql statement may vary. Currently I have a user interface for selecting multiple columns from different tables. I want to pass this information to a stored procedure or build an sql statement. Any feedbacks would be appreciated. Thanks,

paul.
 
Old June 26th, 2003, 12:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

The number of parameters to a stored procedure is fixed when the procedure is created. There is no concept of a variable parameter list.

Parameters can be optional, though. You can define a default value for a parameter if the value is not supplied when the procedure is called.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old June 26th, 2003, 12:44 PM
Authorized User
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So i guess it might be a better option to use sql statement because number of parameters may get huge. Or i could use sp_executesql.
 
Old June 26th, 2003, 06:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.algonet.se/~sommar/dynamic_sql.html

regards
David Cameron





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameters from SQL to VBA Skan Access VBA 4 October 25th, 2007 06:53 AM
sql parameters webbie5 Classic ASP Databases 5 April 12th, 2006 05:21 AM
sql parameters not passed or received redeye2 Pro VB.NET 2002/2003 1 November 5th, 2004 07:10 PM
Custom SQL parameters sphair BOOK: Professional Crystal Reports for VS.NET 1 April 6th, 2004 11:52 PM
SQL output parameters ohiggs SQL Server 2000 4 February 9th, 2004 10:09 PM





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