- Auto-Index generation in C# .Net by coding
- CREATE TABLE [dbo].[Foo](
- [Foo] [int] IDENTITY(1,1) NOT NULL,
- //Other columns
- )
- ALTER TABLE [dbo].[Foo](
- [Foo] [int] IDENTITY(<Enter your last maximum number in the database>,1) NOT NULL,
- //Other columns
- )
- Select Max(Key Field) + 1 from [table name]//this will give you new key value i.e. 12