This could get a little tricky, but there are many ways to do it...
To default a value in a stored proc you simply put and equals sign and a
value after if:
Create procedure Order...
storeID int,
userID int,
productID int = 0
This way if you only pass in storeID and userID then productID will be
created and defaulted to 0 (as shown below):
EXECUTE Order 1,1
The only catch is that you MUST declare the defaulted values LAST in the
stored proc or you'll have problems (I think you can see why)
Good luck!
Bryan Love ACP
[EMAIL PROTECTED]
-----Original Message-----
From: Andres [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 9:01 AM
To: CF-Talk
Subject: Passing variables to a SQL7 stored procedure
What is the equivalent of <cfparam name="var" default=""> inside a stored
procedure?
i want to pass a value to a stored procedure, but the value, and the
variable that holds it, may not be passed all the time.
I want the stored procedure to assign a value of "" to the variable if no
value is passed to it. Then, depending on this variable, it needs to perform
either one of two queries.
can someone give me pointers on how to do this??
thanks
andres leon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists