update column value today date minus 1 in SQL server query?
To update a column value with today's date minus one day in SQL Server, you can use the `DATEADD` function to subtract one day from the current date. Here's how you can do it:
```sql
UPDATE YourTableName
SET YourColumnName = DATEADD(day, -1, GETDATE())
WHERE YourCondition;
```
Replace `YourTableName` with the name of your table, `YourColumnName` with the name of the column you want to update, and `YourCondition` with any condition you want to apply to specify which rows should be updated.
Post a Comment