Reputation: 17
I make automatic inserts to a table. To have a control. Create a [date] column:
[date] datetime default getdate()-1
The date must be from the previous day. That does it. The problem is that the time is changing to 00:00:00.
2021-09-04 17:44:16.303
2021-08-04 00:00:00.000 <-
Do you have any idea how to keep the system time and not go to 00:00:00?
Upvotes: 0
Views: 86
Reputation: 581
You are doing good
just look on this example :
select GETDATE();
select GETDATE() -1;
It just -1 day from now ( include time ) :
Upvotes: 1