Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > BOOK: Beginning SQL
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning SQL
This is the forum to discuss the Wrox book Beginning SQL by Paul Wilton, John Colby; ISBN: 9780764577321
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning SQL 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
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 14th, 2009, 02:56 PM
Authorized User
Points: 493, Level: 7
Points: 493, Level: 7 Points: 493, Level: 7 Points: 493, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2006
Location: gandhinagar, gujarat, India.
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Parameters in stored procedure

Hi all
I have tried to do one general procedure for insert,update,delete.
first i am trying insert.I have one problem:how to pass dynamic parameters and values in stored procedure?
Thanks
monika
  #2 (permalink)  
Old January 14th, 2009, 05:38 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Sorry, what is YOUR definition of a "dynamic parameter"???
  #3 (permalink)  
Old December 1st, 2009, 03:26 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default

you can define a storedProcedure like this:

CREATE PROC dbo.myInsert
(
@ID bigint OUTPUT,
@FirstName nvarchar(20)
)
AS
INSERT INTO someNames(FirstName)
VALUES (@FirstName)

SET @ID = SCOPE_IDENTITY()

RETURN

this stored procedure has 2 parameters, @ID that is used to pass a value back to the user, and a parameter that contains firstName of a persone.

but if you mean that you want to create a procedure that get unlimited and not-defined parameters, you can use this:

CREATE PROC dbo.myInsert
(
@myParameters nvarchar(MAX)
)
AS
/*
here you can some codes to split @myParameters
and get an array of values and types
*/

RETURN

and you can call it
myInsert("@ID:bigint,@firstname:nvarchar(20),etc")
 


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
Stored Procedure Parameters Blank brettdalldorf Crystal Reports 0 September 20th, 2007 02:17 AM
Odbc Parameters Stored Procedure jgrant ASP.NET 2.0 Basics 2 August 26th, 2007 10:21 PM
One textbox, Two Parameters, with Stored Procedure GailCG Classic ASP Professional 0 March 3rd, 2006 03:39 PM
Calling Stored Procedure with parameters zarina_24 Classic ASP Professional 4 March 2nd, 2006 11:57 AM
stored procedure with parameters Danmalam VB Databases Basics 0 February 27th, 2005 03:52 PM



All times are GMT -4. The time now is 04:49 PM.


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