Re: Reset values in serial datatype
Posted in 1995
In article <3ih7oa$jkv@news.xmission.com> dbaresrc@xmission.xmission.com (DBA Resources) writes: |So here's the problem: I have a couple of tables with serial datatypes in |them. Currently we're loading and purging the data in these tables as |we train new users on the applications. We're not concerned with the serial |values 'cause it's just test data. | |In this case I have a significant number of tables that refer to these |columns via foreign keys and when I alter the datatype all the constraints |go south. | |Is there a way of resetting the value of a serial datatype back to 0?? This has worked for me in the past: 1) insert with serial_col = 2147483646 2) insert with serial_col = 0 (uses MAXINT, bumps "next value" to 0) 3) delete from table The next insert will have serial_col == 1 in the versions I've tried (up through 5.0, if I recall). >Carlton Doe "It's not *over* until I win!" >DBA Resources, Inc. -- Les Brown His show was cancelled. It's over. \\-: -- Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland "Think about it - the guys writing these deals are the slimiest, greasiest weasels in sports - agents and GMs. If they were a snack food, 98% of the calories would be from fat, and 90% of the contents would be non-nutritive additives." Chuq Von Rospach, on the NHL/NHLPA negotiations