IS_SPACES
Returns whether a string value consists entirely of spaces. A space is a blank space, a formfeed, a newline, a carriage return, a tab, or a vertical tab.
IS_SPACES evaluates an empty string as FALSE because there are no spaces. To test for an empty string, use LENGTH.
Syntax
IS_SPACES( value )
Argument | Required/ Optional | Description |
---|
value | Required | Must be a string datatype. Passes the rows you want to evaluate. You can enter any valid expression. |
Return Value
TRUE (1) if the row consists entirely of spaces.
FALSE (0) if the row contains data.
NULL if a value in the expression is NULL.
Example
The following expression checks the ITEM_NAME column for rows that consist entirely of spaces:
IS_SPACES( ITEM_NAME )
ITEM_NAME | RETURN VALUE |
---|
Flashlight | 0 (False) |
| 1 (True) |
Regulator system | 0 (False) |
NULL | NULL |
'' | 0 (FALSE) (Empty string does not contain spaces.) |
Tip
Use IS_SPACES to avoid writing spaces to a character column in a target table. For example, if you want to write customer names to a fixed length CHAR(5) column in a target table, you might want to write ‘00000’ instead of spaces. You would create an expression similar to the following:
IIF( IS_SPACES( CUST_NAMES ), '00000', CUST_NAMES )