The MSSQL SPACE function returns a string of specified number of space characters. This function is also available in MySQL with the same name.
space(integer)
The following query concatenates FIRSTNAME and LASTNAME from table EMPLOYEES with two spaces in between. Note we are using SPACE function to put two blank spaces in between.
select firstname+space(2)+LastName from employees
In MySQL also SPACE function can be used to generate a string of blank spaces.
It's syntax is also similar to MSSQL.
SPACE(n)
Where n is the number of blank spaces required
The following query concatenates FIRSTNAME and LASTNAME from table EMPLOYEES with two spaces in between. Note we are using SPACE function to put two blank spaces in between.
mysql> select concat(firstname,space(2),lastname) from employees; +-----------------------------------------------+ | concat(firstname,space(2),lastname) | +-----------------------------------------------+ | Nancy Davolio | | Andrew Smythe | | Janet Leverling | | Margaret Peacock | | Steven Buchanan | | Michael Smith | | Robert King | | Laura Callahan | | Anne Dodsworth | | Nancy Davolio | | Andrew Smythe | | Janet Leverling | | Margaret Peacock | | Steven Buchanan | | Michael Smith | | Robert King | | Laura Callahan | | Anne Dodsworth | +-----------------------------------------------+
Back to Converting Functions from MSSQL to MySQL