Click here to Skip to main content
15,742,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am storing UUID_Short() values in a unique key of my table, now I am trying to use my table's data to SQL Server, R, Power BI and some other Data warehousing tools, but these IDs are not readable in any other environment.

What I have tried:

select convert(dw_ref_id USING utf8mb4), c_date,ord_num,ord_status from orders
it works for SQL Server, but not for others
Updated 4-Oct-22 4:46am
Richard Deeming 4-Oct-22 10:36am    
A UUID_SHORT is a 64-bit unsigned integer. SQL Server doesn't have an unsigned 64-bit integer type; but it does have a signed 64-bit integer type: bigint. Maybe you could convert to that?

1 solution

UUID_Short values are unique to MySql, and are not supported by any other DB as far as I know. They are not the same as a UUID value, being only 64 bits long rather than the standard 128, and there is no mechanism for converting between them as a result.
Indeed, they aren't even global, but use a 256 value installation ID (which tends to be the same for all installations), and the time the server instance saw started as "seeds" for the value:
Returns a “short” universal identifier as a 64-bit unsigned integer. Values returned by UUID_SHORT() differ from the string-format 128-bit identifiers returned by the UUID() function and have different uniqueness properties. The value of UUID_SHORT() is guaranteed to be unique if the following conditions hold:

The server_id value of the current server is between 0 and 255 and is unique among your set of source and replica servers

You do not set back the system time for your server host between mysqld restarts

You invoke UUID_SHORT() on average fewer than 16 million times per second between mysqld restarts

I very much doubt you can use them in any meaningful way on SQL Server without either providing a mapping table which cross links to UUID values, or changing the data to UUID values when you migrate the DB.

But we have no real idea what you are doing here, so ... we can't be at all specific.
Share this answer

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