tags:

views:

16

answers:

1

Hi,

When i run select hex(col1) from table1; i get the result as hex number

for ex: the hex(65) is 41, but i wish to get directly thro sql query the result as 0x41 instead of 41, is there a way to get the result as 0x41?

+4  A: 
select '0x' + hex(col1) from table1

Update:

I misread the tag and answered with the + operator as used in for MS-SQL. As Sharpeye says in the comment,

select concat('0x',hex(col1)) from table1

is the MySQL version.

Blair Conrad
This works,select concat('0x',hex(col1)) from table1;
Sharpeye500
Sharpeye500