SUPPOSE I HV TABLE1 WHICH CONTAINS ID AS PK
N IF I DELETE THE ENTRY SAY FOR ID 2 N 3
NOW D NEXT ID WHICH IS GOING TO INSERT IS 4
SO NOW I WANT TO KNOW THAT ID NO BEFORE ITS INSERTION IN TABLE
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Sep 23, 2011, 2:14 AM
This happen because your PK column is Identity there fore it increaments column count by while inserting by considering deleted value also.....But................
there is solution for it as you want you can get maximum inserted value that column even considering deleted vaule by below line
SELECT IDENT_CURRENT('YourTable Name')
Hope it will solve your problem .
Thanx
Pravin
Pravin MorePosted Sep 26, 2011, 12:08 AM
Thanx,
Pravin.
AmolPosted Sep 24, 2011, 11:38 AM
Manikavelu VelayuthamPosted Sep 23, 2011, 2:13 AM
SELECT IDENT_CURRENT('TableName')