I woulnd't.?\ I'd build the sql as a string, then execute it. But I'm lazy.
Sounds like it should be 2 procedures and you call the correct one based off of a cf variable. -----Original Message----- From: Matthew Smith [mailto:chedders...@gmail.com] Sent: Thursday, April 01, 2010 5:15 AM To: cf-community Subject: porting cf code to a stored proc How would do this in pure stored procedure sql? Either @personkey or @cfuserid will be passed, the other will be null, replacing the attributes vars. INSERT INTO rhkprod_tblCartAdjustments ( <cfif len(attributes.personKey)> tblPeopleFK </cfif> <cfif len(attributes.cfUserID)> cfUserID </cfif> ,tblProductsFK ,adjusted ,originalQuantity ,adjustedQuantity ) VALUES ( <cfif len(attributes.personKey)> #attributes.personKey# </cfif> <cfif len(attributes.cfUserID)> '#attributes.cfUserID#' </cfif> ,@tblProductsFK ,1 ,@cartQuantity ,@quantity ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:314835 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm