Hi All -<br /><br />I administer a third party vendor's system, and in their stored procs I found this pattern which I find strange. Before embarassing myself by incorrectly complaining that this is wrong SQL <img src='/community/emoticons/emotion-1.gif' alt='' /> I wanted to see if others know more than I do.<br /><br />Here's the strange pattern:<br /><br />insert into SomeTable (column) values (value)<br />set @var = ( select @@identity SomeTable )<br /><br />To my eyes, this is just wrong, about three ways, and ought to be <br /><br />insert into SomeTable (column) values (value)<br />set @var = scope_identity()<br /><br />Am I just missing something? Why would one do the first version (other than misunderstanding identity)? The first thing does work, provided there are no triggers performing inserts, but to me it implies that the author wrongly imagines @@identity to be associated with a specific table, which it isn't. Also, it seems they imagine that you need a select just to assign the value to the variable, which makes the "table name" into a column alias.<br /><br />Weird.