SPACE function

The SPACE function creates a character string of a specified number of blank spaces. The maximum length of the returned string value can be 32,739 blank characters.

The function has this syntax:
SPACE Function

1  SPACE ( expression )
Element Description Restrictions Syntax
expression Expression that evaluates to a non-negative whole number < 256 Must be an expression, constant, column, or host variable of a built-in integer type, or one that can be converted to an integer Expression

The argument to the SPACE function must be of a built-in data type.

The SPACE function returns an LVARCHAR string of the specified number of blank (ASCII 32 ) characters.

If the argument evaluates to a NULL value, or to a number less than 1, this function returns a NULL value, rather than an empty string.

In the following example, the SPACE function returns a single-character blank string:
SELECT SPACE(1) FROM tabula_rasa;
The following table shows the output from this SELECT statement, which is a single blank character:
(constant)