dataengref migrate

Home / SQL Server

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

TargetSupportSyntaxNotesSource
SnowflakeSame nameGETDATE()Alias of CURRENT_TIMESTAMP. Returns TIMESTAMP_LTZ in the session time zone (TIMEZONE parameter). Parentheses are required.Snowflake docs
DatabricksSame namegetdate()Synonym of current_timestamp(). Evaluated once at the start of the query.Databricks docs
BigQueryRewriteCURRENT_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

BigQuery

Examples

Rows created in the last 7 days

SQL Server
SELECT * FROM events WHERE created_at >= DATEADD(day, -7, GETDATE());
Snowflake
SELECT * FROM events WHERE created_at >= DATEADD(day, -7, GETDATE());
Databricks
SELECT * FROM events WHERE created_at >= dateadd(DAY, -7, getdate());
BigQuery
SELECT * FROM events WHERE created_at >= DATETIME_SUB(CURRENT_DATETIME(), INTERVAL 7 DAY);

Other SQL Server functions

Last checked: · Paste a whole query into the SQL checker to find every function that needs a change.