8
Apr/10
0

How to reset the Primary Key Index Value on an SQL Table

I recently had to reset the Primary key (Integer, AutoIncrement) from a Table I removed all entries from.

You can use the DBCC CKECKIDENT Statement to achieve this.

Reset Primary Key Index on SQL Table

USE YourDatabase
DBCC CHECKIDENT('YourTable', RESEED, 0)

This would reset the next identity value to begin at 1.

If you are receiving the following error, you might have not switched to the correct Database before executing the Statement:

Msg 2501, Level 16, State 45, Line 1
Cannot find a table or object with the name "YourTable". Check the system catalog.

Make sure you are using the “USE YourDatabase” statement before executing the DBCC .

Print This Post
(3 votes, average: 4.67 out of 5)
Loading ... Loading ...
448 views
24
Oct/09
8

Microsoft SQL 2008 Setup: Performance Counter Registry Hive consistency check failed

If you experience this error on a non English or MUI version of Windows Server 2008 this Registry entry helped me to resolve the issue. It adjusts the Performance counter registry values as described in Microsoft’s KB 300956 (http://support.microsoft.com/kb/300956).

IMPORTANT: Before importing the key, make sure to Export your current Perflib settings stored here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib

Download the Registry Key here: Perflib.zip

SQL2008Perflib

I added a compiled version of Max’s C# code to retrieve the LCID.

  GetLCID (5.0 KiB, 215 hits)

Print This Post
(1 votes, average: 4.00 out of 5)
Loading ... Loading ...
3,160 views