前一天或后一天
程序员文章站
2022-05-30 18:32:18
Insus.NET把它们写成自定义函数,再程序中直接套用即可。 前一天: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- -- Author: Insus.NET -- Create date: 2019-05-15 -- Update dat ......
insus.net把它们写成自定义函数,再程序中直接套用即可。
前一天:
set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: insus.net -- create date: 2019-05-15 -- update date: 2019-05-15 -- description: 前一天 -- ============================================= create function [dbo].[svf_thedaybefore] ( @date datetime ) returns datetime as begin return dateadd(d,-1,@date) end go
后一天:
set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: insus.net -- create date: 2019-05-15 -- update date: 2019-05-15 -- description: 后一天 -- ============================================= create function [dbo].[svf_thedayafter] ( @date datetime ) returns datetime as begin return dateadd(d,1,@date) end go
如果获取昨天或明天日期,传入今天日期进去即可:
上一篇: MySQL知识篇-SQL2