Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Automatic Incrementation of Tables

Author  Topic 

MinalMaurice
Starting Member

4 Posts

Posted - 2005-04-27 : 10:16:59
I apologise for a very elementary question.

I'm migrating data from Access to SQL 2000, to be used from a web site via ColdFusion. I have set up the primary keys in the tables, but when I insert a new record the tables do not automatically increment.

What should I do to force the table to increment the primary key?

Thanks in advance for any assistance.

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-04-27 : 10:44:40
Change your column settings to identity, you can specify where it starts from (seed) and what to increment it
This can be done via EM > Right click on the table and click design view

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-04-27 : 10:46:56
You need to specify the column as IDENTITY.

create table Mytable
(
Mytable_ID int not null
identity(1,1) primary key clustered
)


CODO ERGO SUM
Go to Top of Page
   

- Advertisement -