> SELECT IDENT_CURRENT('tablename ') which returns the latest identity
> in the table name in question. That also prevents getting the
> identity of the wrong table in the event of the query being used as
> part of a trigger which affects multiple tables.
Unless someone has created a new record after your insert, then you'll
get their identity instead. SCOPE_IDENTITY, on the other hand, returns
the last identity value generated for any table in the current session
and the current scope. So with one, you might get someone else's
identity, and with the other you might get the wrong table. Can we ever
win? :)
I guess you could do both methods and compare the results, just to be
sure.
------------------
[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in
error, please immediately contact the sender and destroy the material in its
entirety, whether in electronic or hard copy format. Thank you. A2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236953
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54