> After the insert
>
> SELECT @@IDENTITY AS @newUserKey
Do forgot to SET NOCOUNT ON and OFF around the INSERT statement. The SET
NOCOUNT statment, when ON, will suppress the "(1 row(s) affected)" message
which is returned.
<snip>
DECLARE @NewUserID
SET NOCOUNT ON
INSERT INTO dbo.user_index(
username
,password
,access_level
,active
,email)
VALUES(
@email
,@password
,2
,0
,@email)
SELECT @@IDENTITY As @NewUserID
SET NOCOUNT OFF
</snip>
--
Scott Van Vliet
Sempra Energy
555 W. 5th St., 21st Floor
Los Angeles, CA 90013
Tel > 213.244.5205
Email > [EMAIL PROTECTED]
"Hello Stupid, and welcome to your crappy computer."
- Strong Bad, HomestarRunner.com
> -----Original Message-----
> From: Smith, Matthew P -CONT(DYN)
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 26, 2002 12:20 PM
> To: CF-Talk
> Subject: RE: help writing a stored proc
>
>
> 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
>
>
>
>
>
>
>
>
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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