Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard SQL - CHAR to ASCII

Using standard SQL, SQL-92, how can I convert a character to an ASCII value?

In MySQL it's easy using the ascii() function, but SQL-92 doesn't have this.

like image 573
SlappyTheFish Avatar asked Sep 20 '10 14:09

SlappyTheFish


1 Answers

It appears the SQL-92 standard doesn't even mention ASCII at all.

As you say, each RDBMS vendor would have its own implementation how to convert char->ascii and ascii->char.

Most name this function ASCII().

  • SQL Server ASCII
  • Postgresql ASCII
  • Oracle ASCII
  • MySQL ASCII
like image 109
p.campbell Avatar answered Sep 21 '22 05:09

p.campbell