USE CASE: When we are working on TSQL or some text based scripting we may need some extra space in between two string, we can add space without space function as well but it is possible we may miss to put space in between string or text. If we have to maintain fixed length of space in between string every time we can use TSQL SPACE function.
Returns a string of repeated spaces.
SPACE ( integer_expression ) integer_expression
Is a positive integer that indicates the number of spaces. If integer_expression is negative, a null string is returned. To include spaces in Unicode data, or to return more than 8000 character spaces, use REPLICATE instead of SPACE. Considering employee table has three rows; SELECT FirstName +’,’+SPACE(3)+LastName from employee;