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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server auto increments?

Author  Topic 

RobJ
Starting Member

4 Posts

Posted - 2005-08-07 : 12:42:17
I have a table that consists of an invoice number, the ordering user's customer number, and current shipping status of the invoice.

What I would like is for the invoice number to auto increment whenever I insert into the table. I'm using SQL Server, but I can't find something to check (or whatever) in Enterprise Manager.

I'm certain it's possible, I just have no idea how. Please help!

Cheers,
RobJ.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-08-07 : 12:46:29
you want an Identity column. Look it up in BOL = Books Online = Sql server help.
create table table1
(
id int identity(1,1),
value varchar(50)
)

Go with the flow & have fun! Else fight the flow
Go to Top of Page

RobJ
Starting Member

4 Posts

Posted - 2005-08-07 : 12:51:13
Wow! that was quick :) Thanks
Go to Top of Page
   

- Advertisement -