SQL SPACE Function

SPACE returns a string with repeated spaces.

If more than 8000 spaces are needed, use the REPLICATE function.



This example returns a string with 4 repeated spaces.

SELECT 'Order' + SPACE(4) + 'Received' AS 'With Spaces'
Result:  1 record
With Spaces
Order    Received


Syntax of the SPACE function.


number -- specifies the number of spaces.

You may also like

Last updated on Dec 21, 2023