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 |
|
shajimanjeri
Posting Yak Master
179 Posts |
Posted - 2008-05-27 : 03:15:16
|
| Is there any other way to find the max Id from a SQL table than max(Id)?Someone told me about @@identity. What is it?regardsShaji |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-27 : 03:18:15
|
@@IDENTITY will get you last inserted identity value for whole database, not just one specific table.IDENT_CURRENT('Table1') will get you last inserted value in a specific table in whole database.SCOPE_IDENITTY() will get you last inserted identity value for you current connection only.OrSELECT TOP 1 * FROM Table1 ORDER BY ID DESC E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|