Archive for September, 2008

SCOPE_IDENTITY() returns a value?

September 19, 2008

I have long used SCOPE_IDENTITY() to get the primary key of a newly inserted row immediately after the INSERT statement. For example: INSERT INTO myTableSELET @var = SCOPE_IDENTITY() What I incorrectly assumed was that the value was reset with each statement similar to the behavior of @@ERROR. If not each statement, then each INSERT statement. [...]

Posted in SQL, Software, code Comments Off