Skip to content

Instantly share code, notes, and snippets.

@jarrodhroberson
Last active September 5, 2017 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarrodhroberson/1d7642a49ad48f791f8c4566468dfd6c to your computer and use it in GitHub Desktop.
Save jarrodhroberson/1d7642a49ad48f791f8c4566468dfd6c to your computer and use it in GitHub Desktop.
converting RAW UUID types to Strings via SQL
Database Storage Type How to convert
Oracle RAW(16) REGEXP_REPLACE(binary-guid, '(.{8})(.{4})(.{4})(.{4})(.\*)', '\1-\2-\3-\4-\5')()
SQL Server UNIQUEIDENTIFIER CONVERT(CHAR(36), binary-guid)
MySQL BINARY(16) CONCAT_WS('-',
SUBSTR(HEX(binary-guid), 1, 8),
SUBSTR(HEX(binary-guid), 9, 4),
SUBSTR(HEX(binary-guid), 13, 4),
SUBSTR(HEX(binary-guid), 17, 4),
SUBSTR(HEX(binary-guid), 21))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment