nxpage
Starting Member
49 Posts |
Posted - January 04 2007 : 15:51:22
|
How can we initialize our Order Numbers to start at a specific #? We would like to start with something like 51000, rather than 1, 2, 3, etc. We don't want customers to see that we've only had 3 or 5 or 7 orders to date. Thanks!
Using SQL Server05 |
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - January 04 2007 : 16:31:01
|
vpasp does have an "orderstart" file that comes with it, but if you're on sqlserver, you can do it directly by running a simple sql statement:
DBCC CHECKIDENT ( 'orders', RESEED, 51000 )
the help for that says.....(where "new_reseed_value" is 51000 from the above example)..... Current identity value is set to the new_reseed_value. If no rows have been inserted to the table since it was created, the first row inserted after you run DBCC CHECKIDENT uses new_reseed_value as the identity. Otherwise, the next row inserted uses new_reseed_value + the current increment value.
If the table is not empty, setting the identity value to a number less than the maximum value in the identity column can result in one of the following conditions:
* If a PRIMARY KEY or UNIQUE constraint exists on the identity column, error message 2627 will be generated on later insert operations into the table because the generated identity value will conflict with existing values. * If a PRIMARY KEY or UNIQUE constraint does not exist, later insert operations will result in duplicate identity values.
And... if you want to find out what the current maximum id is, then run this in the advanced query admin screen:
select max(orderid) from orders
If you don't have access to the raw sqlserver database (eg via the host's sqlserver front-end, or enterprise manager), then our "advanced sql execution" (free) tool will let you run that DBCC statement via vpasp admin:
http://www.bigyellowzone.com/shopexd.asp?id=114
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
Edited by - devshb on January 04 2007 16:36:53 |
|
|