> What is forcing you to pass all of the parameters to your procedures?
> I am not following you here... Are you reusing procedures for different
> operations in your application whereby one operation might need to deal
> with a subset of what the procedure was intended for? Named parameters
> in your procparam tag just means you have to maintain code between the
> DB and the calling code... Seems a little tedious to me.

It's a preference of mine... I don't like to write three stored
procedures that do the same thing... I want one up_get procedure that
will return either the entire recordset, those that match a text
lookup or a single record based on PK reference.  Here's a very basic
up_get stored procedure:

CREATE PROCEDURE up_get_status
@nStatus_id INT = 0,
@cSearch VARCHAR(50) = NULL
AS

SELECT status.nStatus_id, status.cLabel
FROM status
WHERE nStatus_id = CASE WHEN @nStatus_id = 0 THEN nStatus_id ELSE
@nStatus_id END
AND cLabel = CASE WHEN @cSearch IS NULL THEN cLabel ELSE @cSearch END

So when I call the SP I can call it three ways:
up_get_status will return everything in the table
up_get_status @cSearch='Open' would return just the record for the
status labelled "Open"
up_get_status @nStatus_id = 13 would return just the record with the ID of 13

Make sense?
Hatton

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188455
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to