CHAR Function in MSSQL and MySQL


The CHAR function returns the character value of the passed ASCII values. In MySQL, you can pass multiple ASCII values separated by commas, whereas in MS SQL Server you can pass only one ASCII value — the MSSQL CHAR function doesn't accept multiple arguments like MySQL does.

MS SQL Server Example

select CHAR(98)
__________________
b

MSSQL CHAR function example

If you pass multiple arguments as in MySQL, it will give an error:

select CHAR(98,97,99)

MSSQL Char Function example 2

MySQL Example

select CHAR(98)
__________________
b

MySQL Char function example

The MySQL CHAR function accepts multiple arguments:

mysql> select CHAR(98,97,99);
------------------------------
bac

MySQL Char function example 2

Back to Converting Functions from MSSQL to MySQL

The MSSQL to MySQL converter will automatically convert MSSQL functions to their equivalent in MySQL while converting views.