|
-
Dec 3rd, 2002, 05:10 AM
#1
Thread Starter
Hyperactive Member
***Resolved***resetting autonumber keys in MS SQL Server 7
Is it possible to reset the autonumber keys in the database.
I have been using the table as a test... but now that its complete.. all my ref numbers start at like 1500 :|
is there a way of resetting the counters... the tables are empty
Last edited by beasty1711; Dec 4th, 2002 at 04:20 AM.
"...They even have the internet on computers..." :- Homer Simpson
"Second Place is First Looser" :- No Fear
-
Dec 3rd, 2002, 07:07 AM
#2
Frenzied Member
Yes.
The identity column should have a seed and an increment. You should be able to reset the seed to whatever you require. ( I can't test it here since I don't have SQL Server in front of me.)
Alternatively, a TRUNCATE may reset the seed...
-
Dec 3rd, 2002, 07:07 AM
#3
Frenzied Member
Yep ucheck the mark identity
fill in a new record with id 0
reset the identity seed starting at 1
delete the added record with id 0
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Dec 3rd, 2002, 07:23 AM
#4
Thread Starter
Hyperactive Member
"...They even have the internet on computers..." :- Homer Simpson
"Second Place is First Looser" :- No Fear
-
Dec 3rd, 2002, 08:51 AM
#5
Here is one more way to reset the identity of the key column
VB Code:
dbcc checkident ('temptab',RESEED,15)
--temptab is the name of the table
Cheers!
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Dec 3rd, 2002, 08:54 AM
#6
Thread Starter
Hyperactive Member
cool.. would i fire that in query analyzer etc?
is the dbcc a sql reserved word?
"...They even have the internet on computers..." :- Homer Simpson
"Second Place is First Looser" :- No Fear
-
Dec 3rd, 2002, 11:13 PM
#7
Originally posted by beasty1711
cool.. would i fire that in query analyzer etc?
is the dbcc a sql reserved word?
Dbcc is a command-line based utility. You can do a lot of things with it. For more on dbcc, refer to books online.
Cheers!
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Dec 4th, 2002, 04:20 AM
#8
Thread Starter
Hyperactive Member
okie
thanx
"...They even have the internet on computers..." :- Homer Simpson
"Second Place is First Looser" :- No Fear
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|