SPACE
Description
Returns a number of occurrences of blank spaces (SPACE in Transact-SQL).
Sample Source Pattern
Syntax
SPACE ( integer_expression ) Snowflake SQL complete documentation
SPACE(<n>)Custom function used to emulate the behavior
function SPACE( occurrences ){
return ' '.repeat( occurrences );
}Examples
Input:
SELECT CONCAT('SOME', SPACE(5), 'TEXT') AS RESULT;Output:
RESULT |
-------------+
SOME TEXT|Input:
SELECT CONCAT('SOME', SPACE(5), 'TEXT') AS RESULT;Output:
RESULT |
-------------+
SOME TEXT|Input:
CREATE OR REPLACE FUNCTION SPACE(occurrences float)
RETURNS string
LANGUAGE JAVASCRIPT
AS
$$
function SPACE( occurrences ){
return ' '.repeat( occurrences );
}
return SPACE( OCCURRENCES );
$$;
SELECT CONCAT('SOME', SPACE(5), 'TEXT') RESULT;Output:
RESULT |
-------------+
SOME TEXT|Last updated
Was this helpful?