Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Saturday, June 9, 2018 9:24 PM
I need to migrate both c# and python code into a view. The code creates a deterministic GUID by hashing the input with an MD5 function and using that as a seed to a UUID call. I can see that MSSQL supports the hash but does anyone know how I can create deterministic GUID from this.
The result needs to be consistent GUIDs for each select of the same data by a consumer.
Sunday, June 10, 2018 5:11 AM
See if this helps
https://stackoverflow.com/questions/2642141/how-to-create-deterministic-guids
and
https://gist.github.com/jen20/33d28a6ed7415f1aaa58
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
SQL Server Integration Services: Business Intelligence
Sunday, June 10, 2018 2:14 PM
Hi,
I have similar code in a couple languages, however the need is to migrate the generation into MSSQL.
Sunday, June 10, 2018 2:57 PM
It seems that
CONVERT(NVARCHAR(32), HASHBYTES('MD5','SomeLongString',2)
Generates a stable deterministic GUID. I imagine a small chance for collision exists, however so far this seems to be reasonable.
Monday, June 11, 2018 6:24 AM
Hi Ritmo2k,
Since you have got your answer, please kindly close the thread by marking the useful reply as answer.
Thanks for your contribution.
Best Regards,
Will
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.