Forum Discussion
Generating Unique Keys in Fabric Data Warehouse
- Anonymous1 year ago
Hi Anonymous ,
Thank you for your follow-up.
Seems you are facing duplicate values when generating unique identifiers using NEWID() and GETDATE().
GETDATE() has limited precision (3 milliseconds), which can lead to duplicate values when multiple rows are inserted in quick succession.Instead of GETDATE(), you may use SYSDATETIME() because it has higher precision (up to 7 decimal places for seconds), reducing the chances of duplicates.
Refer the link for detailed understanding.
If this post helps, please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you for being a part of the Microsoft Fabric Community Forum!
Hi Anonymous ,
Thank you for choosing Microsoft Fabric Community Forum!
Upon reviewing the information provided, Although I have not encountered this error, the suggestions below might assist you in resolving the issue.
-
It's preferable to store GUIDs in a uniqueidentifier column without conversion to avoid truncation and ensure each identifier remains unique.
- For sequential numbers, use the ROW_NUMBER() function with proper concurrency controls to generate sequential unique identifiers within the scope of a query.
If this post helps, please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Regards,
Pallavi.