How to set Identity in sql
I want to set identity by query . . in my table column sno i am set all ready set identity to yes but i want to set id column as a identity in a query how'z the possible suggest me .
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
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 11, 2011, 1:41 AM EDT
like
Alter Table student Drop column [sno]
Alter Table student Add id int identity(1,1)
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 11, 2011, 12:24 AM EDT
CREATE TABLE student (
[sno] [int] IDENTITY(1,1) NOT NULL,
)
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 11, 2011, 12:28 AM EDT
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 11, 2011, 1:17 AM EDT
You can not remove Identity propery of a column with out droping it.
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 11, 2011, 1:21 AM EDT
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 11, 2011, 1:26 AM EDT
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 11, 2011, 1:43 AM EDT
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 11, 2011, 1:45 AM EDT