SCOPE_IDENTITY() and IDENT_CURRENT().
These will grab the last id inserted into a table, etc. but be sure to
make yourself aware of their scopes. I would highly recommend checking
out the t-sql reference here:
http://msdn.microsoft.com/library/default.asp?url="">
I hope this helps...good luck.
----- Original Message -----
From: Alexander Sherwood <[EMAIL PROTECTED]>
Date: Mon, 26 Jul 2004 11:06:45 -0400
Subject: Re: grabbing the id of an item just entered into DB
To: CF-Talk <[EMAIL PROTECTED]>
At 11:00 AM 7/26/2004, you wrote:
>Hi gang.... I remember hearing something a while back where someone wanted
>to grab the id of an item they just entered into the database.... all in one
>sql statement.
[sql query here]
SELECT @@IDENTITY AS 'NEW_ID'
Usually you access the NEW_ID as a column in a recordset returned
from a stored proc.
You also must be using an identity column (I think.....) for this to work.
>Does anyone remember the sql for that?
>
>----------
>[<http://www.houseoffusion.com/lists.cfm/link=t:4>Todays Threads]
[<http://www.houseoffusion.com/lists.cfm/link=i:4:172043>This Message]
[<http://www.houseoffusion.com/lists.cfm/link=s:4>Subscription]
[<http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=808.728.4>Fast
Unsubscribe] [<http://www.houseoffusion.com/signin/>User Settings]
[<https://www.paypal.com/cgi-bin/webscr?amount=&item_name=House+of+Fusion&business=donations%40houseoffusion.com&undefined_quantity=&cmd=_xclick>Donations
and Support]
>
>----------
><http://www.houseoffusion.com/banners/view.cfm?bannerid=36>
>b4e0cf.jpg
>________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

