Thanks guys for the info!
enzo c",)?
http://www.tropangwatakwatak.tk
-----Original Message-----
From: Brian Freeman [mailto:freeman@C...]
Sent: Monday, December 16, 2002 11:39 PM
To: sql language
Subject: [sql_language] RE: UPDATE and INSERT
Just one caution is if you have a trigger that inserts a row in another
table @@Identity will return the ID of that record (because that was the
last record inserted on the connection) but other than that small case
@@identity should work.
Brian Freeman
Carnegie Technology and Bluewave Computing
(xxx) xxx-xxxx ext. 415
www.carnegie.com / www.bluewave-computing.com
-----Original Message-----
From: David Cameron [mailto:dcameron@i...]
Sent: Monday, December 16, 2002 1:12 AM
To: sql language
Subject: [sql_language] RE: UPDATE and INSERT
Yes it is absolutely accurate.
@@IDENTITY returns the ID for the last inserted record on that connection.
As it is dependant on the connection you will not have any issues in a
mulituser environment.
regards
David Cameron
nOw.b2b
dcameron@i...
> -----Original Message-----
> From: Enzo Zaragoza [mailto:enzaux@g...]
> Sent: Monday, 16 December 2002 5:18 PM
> To: sql language
> Subject: [sql_language] UPDATE and INSERT
>
>
>
> How can I get a newly inserted record? For example I
> want to get
> the TransactionID (Autonumber) of the newly inserted record
> using the INSERT
> statement.
>
> Is this code 100% sure that it will get the record you
> inserted? Especially
> on a multiuser environment. This code was taken at
> http://www.adopenstatic.com/Experiments/FastestAutonumber.asp by Ken
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open strConnect
>
> strSQL = "INSERT INTO table1 (Table1Text) VALUES ('" & i & "')"
> objConn.Execute strSQL
>
> strSQL = "SELECT @@Identity"
> Set objRS = objConn.Execute(strSQL)
>
> intID = objRS.Fields.Item(0).Value
>
> objConn.Close
> Set objConn = Nothing
> ~~~~~~~~~~~~~~~~~~~~~~~~
>
> In making updates using UPDATE statement, what's the
> fastest way to check
> if the changes I've is made successful ?
>
> Thanks,
>
> enzo c",)(tm)
> http://www.tropangwatakwatak.tk
>
>
>
>