SQL Server DATEFROMPARTS in Snowflake, Databricks and BigQuery
Snowflake has DATE_FROM_PARTS, Databricks has make_date and BigQuery uses DATE(year, month, day). Out-of-range parts behave differently: SQL Server raises an error, Snowflake rolls them over.
SQL Server function: DATEFROMPARTS(year, month, day) · SQL Server docs
Equivalents
| Target | Support | Syntax | Notes | Source |
|---|---|---|---|---|
| Snowflake | Different name | DATE_FROM_PARTS(year, month, day) | Values outside the normal ranges are accepted, for example month 13 becomes January of the next year. | Snowflake docs |
| Databricks | Different name | make_date(year, month, day) | Invalid dates return NULL or an error depending on ANSI mode. | Databricks docs |
| BigQuery | Different name | DATE(year, month, day) | Invalid dates raise an error. | BigQuery docs |
Behavior differences to check
Snowflake
- DATE_FROM_PARTS(2025, 2, 30) returns 2025-03-02 instead of failing. Validate the parts first if bad input should be rejected.
Examples
First day of each month
SELECT DATEFROMPARTS(y, m, 1) AS month_start FROM periods;SELECT DATE_FROM_PARTS(y, m, 1) AS month_start FROM periods;SELECT make_date(y, m, 1) AS month_start FROM periods;SELECT DATE(y, m, 1) AS month_start FROM periods;