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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to set up the autonumber in sql 2000

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-02 : 08:06:13
Jesus writes "I'm working on a project that is using Microsoft database server Version 8.0 2000 with service pack 3.
At work we use PG for our database and we have what is called sequense tables that automatically give you the next value if you are going be inserting data.
The question that I have is there anything in this database similar to the sequence tables or how is it that the primary key is created?
I check all the datatypes available(bigint, binary, bit, char, datetime, decimal,float, image, int, money, nchar, ntext, numeric, nvarchar, real,smalldatetime, smallint, smallmoney, sql-varient, text, timestamp,tinyint, uniqueidentifier, varbinary, varchar), and unlike MS Access that has a autonumber this one does not have one. The closes is the uniqueidentifier and I don't really know how this one works, all I know is that is supposed to be better than other versions that use the @@IDENTITY.

Could you help me?

Jesus"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-02 : 08:12:54

identity(1,1) will make that column to be autonumber in SQL Server

eg

Create table yourTable (i int identity(1,1),.......)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-03-05 : 23:21:46
Note :

Identity can be set only when u create a table or add new columns to a table.
But when u alter the column then u cannot set the identity property in ur query. Instead u can use Enterprise Manager.



Regards,
satish.r
Go to Top of Page
   

- Advertisement -