Query to put spaces in the columns data

Posted by Virendradugar under Sql Server category on | Views : 2347
Sometimes it's required to have spaces between 2 columns values. For example, You want to combine First name and last name in a single column "Name" while retrieving data and you need some space between both the field.

SQL Server provides a method "SPACE()" which takes an integer value and inserts space, as passed. See below code.

SELECT 'Virendra'+SPACE(10)+'Dugar'

Result of above query:
Virendra Dugar


Comments or Responses

Login to post response