Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fetlock
Starting Member
8 Posts |
Posted - 2003-01-17 : 11:01:12
|
Isn't there a better way to get the id value from a table after inserting a row than... insert T_blah (colx, coly, colz) values (1, 'asdf', 23) select id from T_blah where colx=1 and coly='asdf' and colz=23...since the values inserted have to be unique enough to get the right row...I know I can't just do... select top 1 id from T_blah order by id desc...since multiple users could have added newer rows... unless I did it from the same stored procedure...? hum. *scratches head*I've blanked on this.  |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-01-17 : 11:02:51
|
| select @@identity if it's an identity.Careful you don't start a debate about whether the table should have an id if there are other unique fields :).==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.Edited by - nr on 01/17/2003 11:08:55 |
 |
|
|
|
|
|