After the insert SELECT @@IDENTITY AS @newUserKey
-----Original Message----- From: Brian J. LeRoux [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 26, 2002 1:55 PM To: CF-Talk Subject: help writing a stored proc I want to turn the following into a simple stored procedure: <CFLOCK TIMEOUT="60" NAME="stopDuplicates" TYPE="EXCLUSIVE"> <cfquery name="setNewUser" datasource="#request.dsn#" username="#request.username#" password="#request.pwd#"> INSERT INTO dbo.user_index (username, password, access_level, active, email) VALUES ('#structBillingInfo.email#','#structBillingInfo.userpwd#',2,0,'#structBilli ngInfo.email#') </cfquery> <cfquery name="getNewUser" datasource="#request.dsn#" username="#request.username#" password="#request.pwd#"> SELECT dbo.user_index.* FROM dbo.user_index ORDER BY user_ID DESC </cfquery> </cflock> <cfquery name="setNewUserInfo" datasource="#request.dsn#" username="#request.username#" password="#request.pwd#"> INSERT INTO dbo.user_info ( last_name, first_name, address, address2, city, state, country, shipping, pc_zip, user_ID ) VALUES ( '#structBillingInfo.carholdername#', '#structBillingInfo.carholdername#', '#structBillingInfo.strAddress#', '#structBillingInfo.strAddress#', '#structBillingInfo.city#', '#structBillingInfo.state#', '#structBillingInfo.country#', #structBillingInfo.shipping#, #structBillingInfo.ZipCode#, #get_new_user.user_ID# ) </cfquery> ################################################## So basically, I insert a new user, return their user_ID and populate it into a related table for all the user details. I don't know how to grab that return user_ID for populating via stored procedure. Any and all help is muchos appreciated! Thanks in advance! :) Brian ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

