View previous topic :: View next topic |
Author |
Message |
pcmoonbeam Beginner
Joined: 21 Nov 2005 Posts: 31 Topics: 10 Location: Orange County, California
|
Posted: Mon Sep 19, 2011 3:55 pm Post subject: How Does One Reset An IDENTITY Column |
|
|
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 _________________ Thanks,
PCMOONBEAM |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Mon Sep 19, 2011 4:21 pm Post subject: |
|
|
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 |
|
|
pcmoonbeam Beginner
Joined: 21 Nov 2005 Posts: 31 Topics: 10 Location: Orange County, California
|
Posted: Mon Sep 19, 2011 5:38 pm Post subject: |
|
|
Thank you so much! _________________ Thanks,
PCMOONBEAM |
|
Back to top |
|
|
|
|