In Spark SQL, you can get the current date details only by using current_date() and current_timestamp() so getdate() which is SQL Server function won't work here
Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am using sql query in synapse notebook and unable to use getdate() function in sql query. Please advice.
this query not working
df= spark.sql("""SELECT period_id FROM dim_period_dates
WHERE
GetDate() -1 BETWEEN period_start AND period_end """).
this query is working
df= spark.sql("""SELECT period_id FROM dim_period_dates
WHERE
date_sub(Current_Date(),1) BETWEEN period_start AND period_end
""")
In Spark SQL, you can get the current date details only by using current_date() and current_timestamp() so getdate() which is SQL Server function won't work here
Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav