MySQL Forums
Forum List  »  Microsoft SQL Server

Conversion problem with cast function
Posted by: Alberto Molero
Date: December 03, 2012 09:25AM

Hi all, i have a little problem with cast function in mysql.
I want convert one database (with procedures) in SQL Server to MySQL.
In SQL Server i can do this: Cast(258 As Binary(4)) and return [0, 0, 1, 2], but in MySQL return [32, 35, 38, 00]. The cast function in MySQL convert the number into char and then convert it to binary(4).

I only want do the same that i do with SQL Server...
someone know any solution for this issue?

Table definition:
Create Table If Not Exists TResult(info varbinary(8000));

Insert sample
Insert into tresult (info) values (cast(258 as binary(4)));

Edited 1 time(s). Last edit at 12/03/2012 09:38AM by Alberto Molero.

Options: ReplyQuote

Written By
Conversion problem with cast function
December 03, 2012 09:25AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.