Guys, recently i have transferred by Access database to sql server 2000 n in a process of upgrading the application too. i m using VB6. well i had tables whose id was an "AutoNumber " in ms access. now when it is converted to sql server it is of integer data type. I just wanna know that is there a data type like the AutoNumber in SQL server too. Does the Uniqueidentifie r data type in sql server have the same function as the autonumber in ms access? Or else what is the standard followed to achieve such a task (to generate a unique id for each rows in a table automatically)
AutoNumber
Collapse
X
-
Tags: None
-
1.before inserting the record findout the count.
2.increment that value by 1 and use for the next row. -
yes dude, thats a gud idea but r u sure this is da standard that u all follow? Plus do u mean 2 say there is no alternatives other than this?Originally posted by debasisdas1.before inserting the record findout the count.
2.increment that value by 1 and use for the next row.Comment
-
thank u dude, i recently came across this but i must say since my table is already with data i cannot create a new table. So, in this case i cannot find the type IDENTITY in the data type column when i try to change the table properties. What does it mean?Originally posted by ck9663Try the IDENTITY data type.
Again, it assures uniqueness, not sequence. If you delete a row, that value of your IDENTITY field will not be reuse.
-- CKComment
-
If you can not recreate the table, you can insert a new column of int data type. At the bottom part of the window, change the Identity to "Yes". The seed is the first value that it will use. The increment is how do you want this Autonumber to increment (by 1s, 2s, etc).
-- CKComment
-
Thanks guys, u all have been a gr8 help 2 me. well i got the clue n succeded. thanks once againOriginally posted by ck9663If you can not recreate the table, you can insert a new column of int data type. At the bottom part of the window, change the Identity to "Yes". The seed is the first value that it will use. The increment is how do you want this Autonumber to increment (by 1s, 2s, etc).
-- CKComment
Comment