SPACE (TSQL Function)
Returns a string of the specified length, filled with spaces.
Syntax
SPACE ( length )
Arguments
- length
- is an integer expression of type
int
.
Return Types
Returns varchar
.
Remarks
If length < 0, NULL is returned.
Examples
PRINT '#' + SPACE(10) + '#';
PRINT '#' + SPACE(1) + '#';
PRINT '#' + SPACE(0) + '#';
PRINT '#' + SPACE(-1) + '#';
The result is:
# #
# #
##
<NULL>