how to join on varchar(32) and binary(16) columns in sybase?

Posted by Paul Sanwald on Stack Overflow See other posts from Stack Overflow or by Paul Sanwald
Published on 2011-11-11T19:09:55Z Indexed on 2011/11/29 1:50 UTC
Read the original article Hit count: 111

Filed under:
|

I want to join two tables on a UUID. table A's UUID is represented as varchar(32). table B's UUID is represented as binary(16).

what's the best way to join a varchar to a binary column?

I've tried using some sybase functions for this, but I'm getting different results and unsure of why:

select hextobigint('0x000036ca4c4c11d88b8dcd1344cdb512')
3948051912944290701
select convert(bigint,0x000036ca4c4c11d88b8dcd1344cdb512)
-2877434794219274240

what am I missing about convert and hextobigint? I must be misundstanding at least one of these functions. thanks for your help!

© Stack Overflow or respective owner

Related posts about sql

Related posts about sybase