MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How Does One Reset An IDENTITY Column

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
pcmoonbeam
Beginner


Joined: 21 Nov 2005
Posts: 31
Topics: 10
Location: Orange County, California

PostPosted: Mon Sep 19, 2011 3:55 pm    Post subject: How Does One Reset An IDENTITY Column Reply with quote

I had to drop a test table and load it with data from my production environment which has an IDENTITY column that is automatically incremented by DB2. When I dropped the table, this of course gets reset to 1 and now I get dupes when trying to insert into the table.
I have searched the internet for a solution and gotten no where. Please help me set my identity column to 1905. Thanks Sad
_________________
Thanks,
PCMOONBEAM
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Sep 19, 2011 4:21 pm    Post subject: Reply with quote

pcmoonbeam,

Use the ALTER Command to restart the identity column from 1905 .

ex: (untested)

Code:

ALTER TABLE <your table name> ALTER COLUMN <id col name> RESTART WITH 1905


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pcmoonbeam
Beginner


Joined: 21 Nov 2005
Posts: 31
Topics: 10
Location: Orange County, California

PostPosted: Mon Sep 19, 2011 5:38 pm    Post subject: Reply with quote

Thank you so much!
_________________
Thanks,
PCMOONBEAM
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group