Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

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
0
JoeBo747
Asked:
JoeBo747
1 Solution
 
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
add a column with data type int with the identity property set.
that will do the job
0
 
JoeBo747Author Commented:
Hi Angellll,

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

Regards'
Joe
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now