SQL Server > Query

Concatenate multiple fields in SQL Server

How to filter records based on concatenating multiple fields value in SQL Server?


To concatenate multiple fields in SQL Server, we can use + operator.

SELECT FirstName, LastName, FirstName + ' ' + LastName as FullName  FROM PersonalDetails

The above query would result like below

Concatenated fields in sql server

To filter records based on concatenated columns value, we can still use + operator and then comparison operator like below.

SELECT * FROM PersonalDetails WHERE FirstName + LastName LIKE '%hN%'

The above query would result below result

Filter based on cancatenated columns in sql server

 Views: 1237 | Post Order: 57



Write for us