I have a table that has one id column that is unique, primary key, identifier... And counts 1 every time data is inserted into it!
Now I want to create a procedure that takes care of inserting data into the table and some other tables that are related to this table.
Of course, then I want to retreive the ID from the first column from the INSERT.. how do I do it ?
That is its sole purpose in life. Just be sure to use it right after the insert and before any commit.
Thanks man, you're the hero of the day!
Another question: Is the IDENTITY_VAL_LOCAL() always returning the id of the row that i inserted in my query? Or is it possible that I insert a row, and another person inserts a row a millisecond after and when I use the IDENTITY_VAL_LOCAL() I get the id that was created for the user that created the 2:nd row?