I am looking for a way to return the identity used on an insert. For example:
INSERT INTO foo VALUES('bar')
on table with a schema like:
CREATE TABLE foo (
myId INT IDENTITY(1,1) NOT NULL,
How can I get the value of myId on the previous insert statement with out using a select statement after it? I have several people accessing the database at the same, and it is possible to have two people inserting data at the exact same time and using a select afterwards could lead to the wrong identity being returned.