Hex value from sql select

When I run select hex (col1) from table1; I get the result as a hexadecimal number

for ex: hexadecimal (65) is 41, but I want to get sq sq query directly for the result as 0x41 instead of 41, is there a way to get the result as 0x41?

+3
source share
1 answer
select '0x' + hex(col1) from table1

Update:

I read the tag incorrectly and responded with a statement +that is used for MS-SQL. As Sharpay says in a comment,

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

is a version of MySQL.

+6
source

Source: https://habr.com/ru/post/1761208/


All Articles