How to insert duplicate values to identity column.
Is it possible? If Yes, how?
Loading
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
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Jun 4, 2011, 3:13 AM EDT
Even if you only execute the following command anytime to create any table Is_identity.
Keep in mind:
(i) When it is enabled on a table you must specify a value for the identity column.
(ii) It can only be enabled on one table at a time. If you try to enable it on a second table while it is still enabled on a first table SQL Server will generate an error, it will cause error at runtime of project.
(iii) The user issuing the statement must own the object, be a system administrator.
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Jun 4, 2011, 1:29 AM EDT
What you say? Is this really possible?
Suthish NairRank #92 · 22.8K reputationPosted Jun 4, 2011, 1:34 AM EDT
Vilas GiteRank #951 · 2.1K reputationPosted Jun 4, 2011, 2:55 AM EDT
here, i am trying with rd table
"set identity_insert rd on"
output after i am trying
Vilas GiteRank #951 · 2.1K reputationPosted Jun 4, 2011, 3:02 AM EDT
Incrementation on Identity coloumn automaticly done without duplicating values
Vilas GiteRank #951 · 2.1K reputationPosted Jun 4, 2011, 3:07 AM EDT
yes! it is possible
using reseed : dbcc checkident (rd, reseed, 4)
---------------------------------------------------------------------
If this reply solve your post…then "MARK AS ANSWER"! :)
Suthish NairRank #92 · 22.8K reputationPosted Jun 4, 2011, 3:25 AM EDT
My question was can we do like this:
INSERT [dbo].[Table1] ([id], [name], [date]) VALUES (1, 'a', 'b')
INSERT [dbo].[Table1] ([id], [name], [date]) VALUES (1, 'a','b')
INSERT [dbo].[Table1] ([id], [name], [date]) VALUES (1, 'a1', 'b2')
INSERT [dbo].[Table1] ([id], [name], [date]) VALUES (1, 'a2, 'b3')
INSERT [dbo].[Table1] ([id], [name], [date]) VALUES (1, '4a', 'b4')
So its yes..
I will post more questions..
Vilas GiteRank #951 · 2.1K reputationPosted Jun 4, 2011, 3:35 AM EDT
set identity_insert rd on
INSERT [dbo].[rd] ([prod_id], [prod_desc], [Remark]) VALUES (7, 'cap', 'Black')
INSERT [dbo].[rd] ([prod_id], [prod_desc], [Remark]) VALUES (7, 'ball', 'Green')
Suthish NairRank #92 · 22.8K reputationPosted Jun 4, 2011, 3:42 AM EDT