auto uniqueidentifier

Hi Experts,

Is it possible to add an unique identifier in a SQL server 2005 table, I want the table to include a Key field called "ID" and this to auto increment by 1 for each new record, as autonumber in access?

Regards,
Joe
LVL 1
JoeBo747Asked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
add a column with data type int with the identity property set.
that will do the job
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
yes, this is called an IDENTITY column.

create table TestTab (id int identity , name varchar(100) )
go

insert into TestTab select 'aneesh' union all select 'anoop'

select * from TestTab
0
 
JoeBo747Author Commented:
Hi Angellll,

I was using the wrong data type, thanks for the reply, thats what I needed.

Regards'
Joe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.