sql concat string code example

Example 1: sql concat string with column value

SELECT CONCAT(name, "string_value") AS name
FROM 
  users;

Example 2: sql server concat string and int

SELECT 'Comments: ' + CAST(9 AS varchar(12)) AS Result;

Example 3: concatenation in sql

We use "||" to concatenation in Sql

example:
WHERE LOWER(FIRST_NAME || LAST_NAME)  LIKE '%d%' ;

Example 4: concat two columns in sql server

select Convert(nvarchar(50),ID)+'-'+Convert(nvarchar(50),Year) as ID_Year from tablename

Tags:

Sql Example