Yes, that was what I had. I had a similiar problem with a select and someone gave me this:
SELECT tablePK ,tblProductsFK ,quantity FROM rhkprod_tblCart WHERE (@cfUserID IS NULL OR cfuser...@cfuserid) AND (@tblPeopleFK IS NULL OR tblpeople...@tblpeoplefk) ORDER BY lastUpdatedOn DESC Was hoping to avoid duplicate statements just for readability. Thank you though. Appreciated. On Thu, Apr 1, 2010 at 5:47 AM, C. Hatton Humphrey <[email protected]>wrote: > > > 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 ) > > > IF @PersonKey IS NULL > INSERT INTO rhkprod_tblCartAdjustments > ( tblPeopleFK ,tblProductsFK ,adjusted ,originalQuantity > ,adjustedQuantity ) > VALUES > (@personKey ,@tblProductsFK ,1 ,@cartQuantity ,@quantity ) > ELSE > INSERT INTO rhkprod_tblCartAdjustments > (cfUserID,tblProductsFK ,adjusted ,originalQuantity ,adjustedQuantity ) > VALUES > (@cfUserID ,@tblProductsFK ,1 ,@cartQuantity ,@quantity ) > > Until Later! > C. Hatton Humphrey > http://www.eastcoastconservative.com > > No trees were killed in the sending of this message, but a large > number of electrons were terribly inconvenienced. > > > > On Thu, Apr 1, 2010 at 5:14 AM, Matthew Smith <chedderslam@ > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:314741 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm
