HomeHome Product Discus... Product Discus...SmithCartSmithCartSeeding the OrderID in your StoreSeeding the OrderID in your Store
Previous
 
Next
New Post
2/5/2010 6:17 PM
 

By default after you install the cart and place your first order you will notice that the orderid the cart generates is 1. Depending on your preference you may want to start the orderid at 1001. The reason that the orderid starts at 1 is because the orderid in the Smith_StoreOrders table is an identity column and by default in sql server an identity column’s first value is 1 and each new value increments by one (1, 2, 3, 4, and so on). Identity columns generates sequential values for new records using a seed value. The term seed refers to the internal value SQL Server uses to generate the next value in the sequence. You can control the column’s first and subsequent values, by specifying those values in the table designer in sql server management studio. For instance, you might want to begin with a order id of 1001 rather than 1.

To set the seed value for the orderid follow these steps:

  1. Load sql server management studio
  2. Click on your database and open up the tables tree view
  3. Right click on the smith_storeorders table and click design
  4. Click on the orderid column
  5. At the bottom of the screen you will see column properties. Scroll to the property titled "Identity Specification" and click the plus sign and you will see the following screen

  1. Enter a value like 1001 in the field titled "Identity Seed"
  2. Save your changes


New orders in your store will now start at 1001

 

The good news is that seeding and reseeding an identity column is easy and relatively safe, if you do it correctly. It’s common to seed a new table or to reseed an empty table in production. However, as a general rule, it’s not a great idea to reseed an identity column in a table that contains data because if you change the seed value to an orderid that already exist in the smith_storeorders table it will result in a duplicate key value and throw an error when the cart tries to save an order so if you decide you want to reseed your orderid then its a good idea to do it before you go into production and start taking orders. If you decide to reseed the orderid when you already have orders in the smith_storeorders table make sure you set the seed value greater than your last orderid.


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
Previous
 
Next
HomeHome Product Discus... Product Discus...SmithCartSmithCartSeeding the OrderID in your StoreSeeding the OrderID in your Store