|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Resetting Primark keys (ID)
Hey People
First time user and SQL Server novice here. I've had to delete ALL records from a SQL Server database and the primary key in all of the tables was "Trip_id" which was an automatically generated numeric id. Now i've started to load the data back into the tables and i would like to reset Trip_ID so that the first record will have the ID of 1, not 8945 like it is at the moment. How can i do this? Cheers. |
|
#2
|
||||
|
||||
|
You will have to remove (delete) the column from the table, then recreate it.
|
|
#3
|
|||
|
|||
|
Oh ok, thanks for the help mate.
This is definately the only way though? Theres no sql command i can use to reset the id? |
|
#4
|
||||
|
||||
|
Nope.
|
|
#5
|
|||
|
|||
|
DBCC_CHECKIDENT will reset identity values in SQL Server.
http://msdn.microsoft.com/library/e...s_dbcc_5lv8.asp |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Resetting Primark keys (ID) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|