[thelist] returning the row id after an insert (MS SQL 7)
Rory.Plaire at wahchang.com
Rory.Plaire at wahchang.com
Thu Dec 6 12:16:46 CST 2001
+| anyhow, since you are using sql/server, you should look into
+| @@identity
+|
FWIW, SQL2K has some new ways to dance with that last inserted row:
* Scope_Identity() gets the last inserted identity in a scope (function,
procedure, trigger, or batch)
* IDENT_CURRENT('table_name') gets you the last identity for a table in any
scope or connection.
while...
* @@identity gives you the last identity inserted on a connection across
scopes and tables. (meaning, if you have a trigger insert a row, you'll get
that id, not the one for the row that you inserted into the table you
explicitly did so)
<rory alt="8)">
More information about the thelist
mailing list