Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there an Auto Increment number data type?

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
0
36
US
In Access there is a field type called "AutoNumber"
so each time a new record is added it automatically puts a value in there. the next record gets a the next value etc.
Like:
1
2
3
4

I used that a lot in Microsoft Access and now I converting those databases to SQL server 7.
I thought "uniqueidentifier" was it but I think that is something thats not accessible.

TIA
 
IDENTITY (seed, increment ) is a field property
example
CREATE TABLE new_employees
(
id_num int IDENTITY(1,1),
fname varchar (20),
minit char(1),
lname varchar(30)
)
The gory details are in BOL
 
OK
So I have to use T-SQL to create my tables
I was hoping I could used the
 
ALTER table can also be used to add an identity column to existing tables.
 
You also can mark a column as Identity when you are in design mode. First change the type of the column to Int, then Uncheck the checkbox that allows Null values, and check the Indentity checkbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top