Results 1 to 2 of 2
-
02-04-2012, 09:43 AM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,175
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Reset Identity Column - Microsoft SQL
Reset Identity Column - Microsoft SQL
Sometimes after deleting all the rows in a table you want to get the identity column set to 0 so next row you would add starts at identity column value of 1.
Here is an example sql code that would reset table myTable identity column to 0; so next row you insert would have identity column of 1.
DBCC CHECKIDENT('myTable', RESEED, 0)Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
-
02-17-2012, 09:23 AM #2
Nice, simple tip. Thanks
Similar Threads
-
Set Identity Insert On Off - Microsoft SQL
By manik in forum DatabasesReplies: 3Last Post: 04-05-2011, 02:08 AM -
Insert Max int Type Primary Column Value + 1 - Microsoft Sql
By manik in forum DatabasesReplies: 1Last Post: 04-05-2011, 01:26 AM -
Get Column Names of Table - Microsoft Sql
By manik in forum DatabasesReplies: 0Last Post: 03-02-2011, 05:08 PM -
Alter Table Column as Identity - MS SQL
By manik in forum DatabasesReplies: 1Last Post: 10-21-2010, 03:46 AM -
How to Check if a Column is Identity - MS SQL
By manik in forum DatabasesReplies: 0Last Post: 05-28-2010, 10:33 AM


Reply With Quote

