Hi!

On May 12, Larry Lowry wrote:
> A uniqueidentifier in MS SQL is basically a guid.  I am generating
> them via System.Guid.NewGuid().ToString(N") in the Dot Net
> framework which now returns me a string of 32 characters (hex). 
> Internally I understand it is a 128-bit integer.  As an option I could
> store that in MySql.  What data type would that be?
> 
> How would one convert to binary char(16)?  In what documentation
> would I find this?   I do not know enough yet to write a UDF.  

In 4.1.2 you can use function UNHEX():

  UNHEX(REPLACE(uuid, '-', ''))

will convert uuid to 16-byte string
There's no easy way to do a reverse conversion yet. HEX() will do, but
you'll lose dashes.
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/  www.mysql.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to