SQL Select within 24 hours?

前端 未结 1 1380
时光说笑
时光说笑 2021-01-29 16:14

People.Born is of type datetime. I would like to delete only the people that were born within the last 24 hours. I am running this as a stored procedure inside of Visual Studio

1条回答
  •  [愿得一人]
    2021-01-29 16:48

    Not positive which version of SQL you're using, but I've never seen "day" as an appropriate first argument to dateadd. Try dd instead:

    DELETE 
    FROM People
    WHERE People.Born >= DATEADD(dd, -1, GETDATE());
    

    0 讨论(0)
提交回复
热议问题