EnterpriseDB: The Enterprise Postgres Company Postgres Plus Forums: The PostgreSQL Open Source Database from EnterpriseDB
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 

cast md5 hash to bigint  XML

Forum Index » GridSQL - General
Author Message
Don_N

New member

Joined: 03/12/2008 17:15:20
Messages: 9
Offline

In SQL Server, I might do something like this to create IDs for dimensions.

select convert(bigint, convert(binary( 8 ), hashbytes('md5', 'foo')))

Result:
-5999611798422882212

How would I do the same in GridSQL?

Thanks.
Don

This message was edited 1 time. Last update was at 04/12/2008 13:25:30

Atul_D

New member

Joined: 21/03/2008 01:55:32
Messages: 9
Offline

Hi Don,
If your IDs can be hex or text strings, you can do the following:
select md5('foo');
md5
----------------------------------
acbd18db4cc2f85cedef654fccc4a4d8
(1 row)

Direct conversion of this value to a bigint causes an overflow. Will post an update if I find any alternate way to convert hex value to bigint.

--
Atul
 
Forum Index » GridSQL - General
Go to:   
Powered by JForum 2.1.8 © JForum Team