Home > Archive > MS SQL Server New Users > June 2005 > AutoIncrement Primary Key









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author AutoIncrement Primary Key
Gabe Matteson

2005-06-08, 11:23 am

Is there anyway to auto increment the primary key column like you can in
access but for SQL 2000? Thanks,
- Gabe


Narayana Vyas Kondreddi

2005-06-08, 1:23 pm

You could use the IDENTITY property for an interger column for this. For
example:

CREATE TABLE x (i int IDENTITY(1, 1), j int)
Go

--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @ http://vyaskn.tripod.com/


"Gabe Matteson" <gmatteson@inquery.biz.nospam> wrote in message
news:eRH90lEbFHA.2876@TK2MSFTNGP09.phx.gbl...
Is there anyway to auto increment the primary key column like you can in
access but for SQL 2000? Thanks,
- Gabe



Gabe Matteson

2005-06-08, 1:23 pm

Nevermind, thanks.

"Gabe Matteson" <gmatteson@inquery.biz.nospam> wrote in message
news:eRH90lEbFHA.2876@TK2MSFTNGP09.phx.gbl...
> Is there anyway to auto increment the primary key column like you can in
> access but for SQL 2000? Thanks,
> - Gabe
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com