Typically you'd do a query like this to use @@identity:

SET NOCOUNT ON

INSERT INTO (whatever ...)

SELECT @@identity AS newId;

SET NOCOUNT OFF

Then in your CF code the new ID can be retrieved from the query using
queryName.newId

Matt


On Thu, 10 Mar 2005 08:30:33 -0800 (PST), Jordan Gouger
<[EMAIL PROTECTED]> wrote:
> Really... Wow there so much that I need to learn about SQL server.  I have
> always retrieved identity by wrapping an insert with a transaction and then
> selecting the max ID ie SELECT MAX(Identity) AS MaxID in another query. 
>   
> How do you effectivily use the @@Identity property? 
>   
> Thanks, 
>   
> Jordan
> 
> "Schreck, Tom" <[EMAIL PROTECTED]> wrote: 
>  
>  
> 
> Is there a way to query what the next sequence number will be?  In SQL
> Server, you can use @@Identity to retrieve the newly inserted record's
> identity value.  In ORACLE, they use sequences.  I need to know the value of
> the sequence so I can return it after inserting a record. 
> 
>   
> 
>   
> 
> Thanks 
> 
>   
> 
> Tom Schreck 
> 
> Applications Developer 
> 
> Dresser, Inc. 
> 
> 15455 Dallas Parkway, Suite 1100 
> 
> Addison, TX  75001-4690 
> 
> 972-361-9943 
> 
> [EMAIL PROTECTED] 
> 
>   
> 
>  
> 
>   
> 
>   
> 
>  
> 
>    
>  


-- 
Matt Woodward
[EMAIL PROTECTED]
http://www.mattwoodward.com
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to