Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve Column Identity after Insert?

Status
Not open for further replies.

JohnBeals

Programmer
Feb 26, 2002
49
US
On SQL 7, using a Query Insert:
I need to get the Column Identifier of the new record after an Insert. Does the Insert return any values?

My concern is, that if I get the last ID and then assume the next ID is from the record I inserted, another user could possibly do an insert between my querying the last ID and inserting the new record.

Your assistance is appreciated!
JB
 
You should be able to capture the value of @@IDENTITY after the INSERT statement to access the id value inserted in table.
--Angel
-----------------------------------
SELECT * FROM users WHERE clue > 0
0 row(s) selected
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top