Saturday, October 8, 2011

SQL String Concatenation in Informix, MySQL and SQL Server

Like selecting the top N rows, syntax for string concatenation is DBMS-specific. The following are examples for Informix, MySQL and SQL Server.

Informix

select name || ' ' || surname
from customer;

MySQL

select concat(name, ' ', surname)
from customer;

Note: the MySQL concat() function can accept any number of arguments.

SQL Server

select name + ' ' + surname
from customer;

No comments:

Post a Comment