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 |
|
haekz008
Starting Member
10 Posts |
Posted - 2012-01-29 : 00:15:06
|
is there anyone who knows a query on how to get the last value that was added into the database?for example :i added a new item and i want to get the item id of new item that was added,.,im hoping for your answers,.,thankyou guys haekz008 |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2012-01-29 : 06:22:10
|
| Look at books online about @@identity and scope_identity. After doing an insert into a table with an identity column you can set a variable with either one of these and return it as an output.Mike"oh, that monkey is going to pay" |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-01-29 : 07:20:38
|
| Also look up the OUTPUT clause.--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|