Home Forums Programming General Converting between binary hex and GUID (uniqueidentifier) RE: Converting between binary hex and GUID (uniqueidentifier)

  • This seems to work fine for me unless I'm missing something...

    DECLARE @GUID UNIQUEIDENTIFIER, @binary VARBINARY(16)

    SELECT @GUID = NEWID()

    SELECT @binary = CAST(@guid AS VARBINARY(16))

    SELECT
    @GUID AS Here,
    @binary AS There,
    CAST(@binary AS UNIQUEIDENTIFIER) AS BackAgain


    SELECT quote FROM brain WHERE original = 1
    0 rows returned