SQL Server GETDATE in Snowflake, Databricks and BigQuery
Snowflake and Databricks both accept GETDATE(), so the call itself keeps working. BigQuery has no GETDATE; use CURRENT_DATETIME() or CURRENT_TIMESTAMP(). The real difference is the time zone of the result.
SQL Server function: GETDATE() · SQL Server docs
Equivalents
| Target | Support | Syntax | Notes | Source |
|---|---|---|---|---|
| Snowflake | Same name | GETDATE() | Alias of CURRENT_TIMESTAMP. Returns TIMESTAMP_LTZ in the session time zone (TIMEZONE parameter). Parentheses are required. | Snowflake docs |
| Databricks | Same name | getdate() | Synonym of current_timestamp(). Evaluated once at the start of the query. | Databricks docs |
| BigQuery | Rewrite | CURRENT_DATETIME([time_zone]) | Returns DATETIME without a time zone, in UTC unless a time zone is passed. CURRENT_TIMESTAMP() returns a TIMESTAMP (an absolute point in time). | BigQuery docs |
Behavior differences to check
- SQL Server GETDATE returns the local time of the database server as DATETIME with no time zone. Cloud warehouses default to UTC or the session time zone, so day boundaries and "today" filters can shift by several hours. Set the session time zone or pass one explicitly.
BigQuery
- Use CURRENT_DATETIME('America/New_York') (or your server's zone) to reproduce local wall-clock time.
Examples
Rows created in the last 7 days
SELECT * FROM events WHERE created_at >= DATEADD(day, -7, GETDATE());SELECT * FROM events WHERE created_at >= DATEADD(day, -7, GETDATE());SELECT * FROM events WHERE created_at >= dateadd(DAY, -7, getdate());SELECT * FROM events WHERE created_at >= DATETIME_SUB(CURRENT_DATETIME(), INTERVAL 7 DAY);