Saturday, November 13, 2010

How to reseed an identity field

When I create e-commerce sites, the order numbers always start at 1. My customers like to pretend that they've had lots of orders when they launch, so I need to update their order number to something higher. The problem is this is always the identity field of the table. This command does the trick. It doesn't update the old order numbers, but I don't need those updated so it's no big deal.

DBCC CHECKIDENT('order', RESEED, 1000070 )

No comments:

Post a Comment