SQL Server > String related

Concatenate two string types columns separated by a space in SQL Server

How to concatenate two string types columns separated by a space in SQL Server?


To concatenate two string type columns separated by space, we can use space function.

SELECT FirstName + SPACE(1) + LastName
 FROM PersonalDetails

Notice the SPACE(1) function in between FirstName and LastName. As the parameter value passed in SPACE function is 1 so there will be one blank space in between FirstName and LastName column values.

 Views: 1514 | Post Order: 70



Write for us