March 8, 2012 at 10:21 am
Hi Friends,
Any one can tell me what is uniqieidentifier ? where we use this?
Thanks,
Sandeep.
March 8, 2012 at 10:33 am
uniqueidentifier is a data type.
BOL
Merge replication and transactional replication with updating subscriptions use uniqueidentifier columns to guarantee that rows are uniquely identified across multiple copies of the table.
March 8, 2012 at 10:33 am
Is it an interview question?
March 8, 2012 at 10:59 am
To answer when you should use it...I would avoid it unless there is a legitimate reason to use it. Often it gets used as a primary key which causes performance issues due to fragmentation of indexes and pages. Additionally it is just simply a PITA to work with. It is really hard to type one manually and get it right. And although the type is uniqueidentifier it is possible to get duplicates, although the probability of this is incredibly small. Best to just not use them when there is a different option.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 8, 2012 at 8:39 pm
Sean Lange (3/8/2012)
To answer when you should use it...I would avoid it unless there is a legitimate reason to use it. Often it gets used as a primary key which causes performance issues due to fragmentation of indexes and pages. Additionally it is just simply a PITA to work with. It is really hard to type one manually and get it right. And although the type is uniqueidentifier it is possible to get duplicates, although the probability of this is incredibly small. Best to just not use them when there is a different option.
I couldn't have said it any better.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 12, 2012 at 3:54 am
Hi,
Generally Uniqueidentifier is a 36 bit alphanumeric unique Value that will not be duplicated.
Its syntax is XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
It is a data type in SQLServer & it will be mostly used as Primary Key.
March 12, 2012 at 5:18 am
ard5karthick (3/12/2012)
Hi,Generally Uniqueidentifier is a 36 bit alphanumeric unique Value that will not be duplicated.
Its syntax is XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
It is a data type in SQLServer & it will be mostly used as Primary Key.
Uniqueidentifier is a 16-byte binary values that operates as globally unique identifiers (GUIDs). The main use for a GUID is for assigning an identifier that must be unique in a network that has many computers at many sites.
There is no such things as syntax for datatypes... It's like saying, that a Datetime has a syntax of DD MMM YYYY HH:MM:SS:mmm 🙂
This data type in SQLServer used as Primary Key, mostly by people who has no idea of what they are doing or ones who forced to do it by above people.
I do use this datatype mainly when I need to store something "very technical" for the application: For example: operation handle/key issued by the app which can be used for transactions grouping...
March 12, 2012 at 11:55 am
It has a Constant Format in which it will appear,
And it is 36 Bit not 16 Bit and Each Digits can be of HexaDecimal Value From (0 -9) and (A- F)
For more Info refer the below Link,
March 12, 2012 at 12:33 pm
ard5karthick (3/12/2012)
And it is 36 Bit not 16 Bit and Each Digits can be of HexaDecimal Value From (0 -9) and (A- F)
For more Info refer the below Link,
http://msdn.microsoft.com/en-us/library/ms187942.aspx%5B/quote%5D
And the first line of this article...
Is a 16-byte GUID.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 12, 2012 at 1:24 pm
ard5karthick (3/12/2012)
And it is 36 Bit not 16 Bit and Each Digits can be of HexaDecimal Value From (0 -9) and (A- F)
For more Info refer the below Link,
http://msdn.microsoft.com/en-us/library/ms187942.aspx%5B/quote%5D
Format is not a syntax, actually its appearance also depends on a client, it may appear with or without curved brackets...
And about 32 vs 16 Bit - you can see in the previous post and at the article you refer to yourself. If you like to measure it in Bits, it won't be 16 nor 32 but 128 Bits (1 Byte - 8 Bits) :hehe:
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply