Skip to content

SQL SPACE is a string function that replicates the number blanks that you want add to the given string.




SYNTAX

SPACE(number)

number is an integer value.

Lets look at an example of  SQL SPACE Function.

The following example concatenates, two string  ‘Micorsoft Sql server’ , 15 spaces and ‘2017’

SELECT 'Microsoft SQL SERVER'+ SPACE(15)+'2017' as Output

 

Lets try to achieve same output without using SPACE function.

Without using space function, we need to add blank manually. To add blank we press enter key 15 times in a sequence.

SELECT 'Microsoft SQL SERVER'+ '                ' +'2017' as Output

 

Also Read..

SQL Server String Functions

LEAD()

LAG()

FIRST_VALUE()

LAST_VALUE()

 




Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.