How can we set auto increment value of primary key through query
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jul 26, 2012, 2:02 AM EDT
Select @key=Isnull(MAX(UseriD),0)+1 from tbl_user
insert into tbl_user values(@key,'username','xxxxx')