auto increase primary key value
Posted on 2003-03-21
I am thinking if there is a way to let SQL server auto increase a primary key value. Like "serial" data type in informix, informix auto increases its number whenever a record is inserted into the database.
I only found there is "uniqueidentifier data type" in SQL, which taks 16 bytes. This is two huge for some application, I only need an integer.
Is there a way , i.e. write a function in SQL to let it auto increase a primary key value(plus one on privious record's primary key)? I don't want application program to trace this value.
How much cost will those functions be? i.e. time used in SQL server. I need continusly insert records to database in realtime.