Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
i create a unique identifier called rowguid like this
SQL
rowguid uniqueidentifier default newsequntialid()


this generates unique rows. Is it a good idea to use the rows generated as primary key?
Posted

1 solution

From my personal experience, I always prefer a sequential auto-number as a primary key for any given table.

The function newsequntialid() does not guarantee that the guid is always really sequential. Keep in mind that these are sequential and, in theory, you might also end up with duplicates.

Further more, read here for a more detailed explaination
 
Share this answer
 
Comments
Rakshith Kumar 7-Oct-13 5:33am    
Agreed with the points that you have told.
I can use
rowguid int identity(1,1) primary key.

Can you please tell me a scenario wherein i can use rowguid
Ryan Zahra 7-Oct-13 5:43am    
The rowguid is mainly used to solve page-split clustered indexes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900