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.
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.
Abhimanyu K VatsaPosted Jun 4, 2011, 7:13 AM
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.
Suthish NairPosted Jun 4, 2011, 7:42 AM
Vilas GitePosted Jun 4, 2011, 7:35 AM
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 NairPosted Jun 4, 2011, 7:25 AM
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 GitePosted Jun 4, 2011, 7:07 AM
yes! it is possible
using reseed : dbcc checkident (rd, reseed, 4)
---------------------------------------------------------------------
If this reply solve your post…then "MARK AS ANSWER"! :)
Vilas GitePosted Jun 4, 2011, 7:02 AM
Incrementation on Identity coloumn automaticly done without duplicating values
Vilas GitePosted Jun 4, 2011, 6:55 AM
here, i am trying with rd table
"set identity_insert rd on"
output after i am trying
Suthish NairPosted Jun 4, 2011, 5:34 AM
Abhimanyu K VatsaPosted Jun 4, 2011, 5:29 AM
What you say? Is this really possible?