My collection of snowflake additional functions. mostly because I missed these functions in Snowflake. Currently:
- Date functions
- Conversion functions
- BLANKIFNULL(): replaces a NULL value with a blank string
- NULLIFBLANK(): replaces a blank string with a NULL value
Returns last day in a month, based om given date.
| parameter_name | data_type | description | valid_inputs | defaults |
|---|---|---|---|---|
| @what_to_check | date | a date in format YYYY-MM-DD | "2025-02-01" | (none) |
SELECT EOMONTH('2024-02-15')
Returns last day of a year. Parameter: date
| parameter_name | data_type | description | valid_inputs | defaults |
|---|---|---|---|---|
| @what_to_check | date | a date in format YYYY-MM-DD | "2025-02-01" | (none) |
SELECT EOYEAR('2024-02-15')
Returns first day of a year. Parameter: date
| parameter_name | data_type | description | valid_inputs | defaults |
|---|---|---|---|---|
| @what_to_check | date | a date in format YYYY-MM-DD | "2025-02-01" | (none) |
SELECT BOYEAR('2024-02-15')
As a counterpart of ZEROIFNULL. Returns blank string if its argument is NULL; otherwise, returns its argument.
| parameter_name | data_type | description | valid_inputs | defaults |
|---|---|---|---|---|
| @what_to_check | varchar | some text, of a null value | valid varchars | (none) |
SELECT BLANKIFNULL(columnname)
FROM tablename;
As a counterpart of NULLIFZERO: Returns NULL if the argument is blank string; otherwise, returns the argument.
| parameter_name | data_type | description | valid_inputs | defaults |
|---|---|---|---|---|
| @what_to_check | varchar | some text, of a null value | valid varchars | (none) |
SELECT NULLIFBLANK(columnname)
FROM tablename;
Feel free to contact me at wfvdijk@gmail.com