Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

subtracting one date from GETDate function in T-SQL


I'm converting a MySQL query to T-SQL

I'm using SQL Server 2019

I have a line of MySQL code like this that  subtracts one day from today's date and sets that value to the  employee_start_date column.


employee_start_date = (DATE_SUB(CURDATE(), INTERVAL 1 DAY)

Open in new window


What is the equivalent of the above line in T-SQL?


So far I have this:


-- T-SQL code
employee_start_date = CAST(GETDATE() AS date)

Open in new window





ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maqskywalker
maqskywalker

ASKER

Thank you