tony weeg, web application developer
navtrak gps tracking | revolution web design inc
home | about me | my resume | my work | navtrak gps tracking
Wed 16
August
2006
How to reset and Identity seed in SQL Server
Posted At : 8:46 AM | Posted By : tony
Searching today for my own good and use here at Navtrak, I found a simple little SQL Script that reseed's an identity column down to any value you choose.

Now, this will SERIOUSLY mess your application up if you are using the identity column as your ID in a Foreign Key elsewhere. However, in this case where I am generating unique serial numbers it works just fine. We started at 0, and through testing it jumped up to 250. Production wanted to start at 0 and for that reason we used this:

DBCC CHECKIDENT('uniqueSerials', RESEED, 0)

Comments

Nice tip. I've never see that before. Sure beats dropping and recreating the table.


You can also accomplish this by using TRUNCATE TABLE [tablename]. Obviously this will remove all the data in the table. However if you are moving from a test enviroment into a production enviroment, I'm pretty sure you don't want any test data in the table. Check the BOL for more information.


However if you are moving from a test enviroment into a production enviroment, I'm pretty sure you don't want any test data in the table. Check the BOL for more information.





search
<< January 2009 >>
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

recent posts:
No recent entries.
tag cloud
baseball blogging buddhism clients code coldfusion coldfusion server firefox flash games flex football golf google grantland graphic design in memory javascript just plain cool kennedy lost max music navtrak gps tracking nfl oakland raiders pets politics rocky snowboarding the grande farce tony weeg voip web design wtf??!! youtube
all tags
Adobe (1)
Art (1)
Baseball (6)
Blogging (9)
Boxing (1)
Buddhism (4)
Clients (6)
Code (24)
ColdFusion (95)
ColdFusion Server (4)
Dreamweaver (1)
Firefox (5)
Flash games (8)
Flex (9)
Football (8)
Golf (29)
Google (33)
Grantland (3)
Graphic Design (2)
In memory (11)
Javascript (6)
Just plain cool (49)
Kennedy (2)
Lily (1)
LOST (11)
Map Geek (1)
MAX (9)
Money (1)
Music (10)
Navtrak GPS Tracking (18)
Nerdfootball.Com (1)
NFL (12)
Oakland Raiders (6)
Pets (3)
Photography (1)
Politics (43)
Portfolio (1)
Rocky (7)
Sarah Palin (1)
Seagull Century (1)
Snowboarding (5)
Soccer (1)
The Grande Farce (2)
Tony Weeg (81)
VOIP (2)
Weather (1)
Web Design (3)
wii (1)
wtf??!! (41)
YouTube (3)
feelin' bloggy?
· googling google
· a list apart
· the adsense team
· jd on mx
· wandering the pathless land
· steven erat
· Google Addict
· adam lehman adobe
· mike tangorre figleaf
· ray camden jedimaster
· sean corfield
· ben forta adobe
subscribe here

rss feed
Short Mode / Full Mode

thank you ray camden, great blog, download here.
my blog is aggregated by

All text herein Copyright Revolution Web Design, Inc., 1973 - 2009 (Unless otherwise noted)