question

Sudheer avatar image
Sudheer asked

Newid() is repeatable ?

Hi, Newid() is repeatable ? Please give the correct suggestion.. Thanks in advance
sql-server-2012newid
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nash9991 avatar image Nash9991 commented ·
Hi Sudheer, Could you please explain what you are trying to achieve?
2 Likes 2 ·
ThomasRushton avatar image
ThomasRushton answered
If you mean is it guaranteed to generate something that's absolutely unique, will never be regenerated across the world, then you're out of luck. Original bug: http://www.glorf.it/blog/2008/05/16/sql-talk/sql-server-is-not-aware-of-nondeterministic-functions Itzik Ben Gan's take on it: http://www.sqlmag.com/article/sql-server/bug-with-newid-function-99807 MS Connect item: https://connect.microsoft.com/SQLServer/feedback/details/350485/bug-with-newid-and-table-expressions Granted, these are all for SQL 2008 R2 and before; but given that MS closed the bug as "Won't fix", then, chances are, this is still the case in SQL Server 2012.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
They can certainly duplicate. I used to support a distributed system with about 1,000 computers generating new uniqueidentifier values and we got duplicates every couple of months. Update: Just got another one today :)
5 Likes 5 ·
priyanka avatar image
priyanka answered
Never repeated
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
Do you mean they've fixed it in SQL 2016?
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.