/******************************************************
关于日期时间型数据类型
Declare @startDate char(10)
select * from salehistory0503 where saledt='2005-03-01'
相当于
select * from salehistory0503 where saledt='2005-03-01 00:00:00'
没有'2005-03-01 24:00:00'
select * from salehistory0503 where saledt>='2005-03-01' ans saledt<'2005-03-02'
select * from salehistory0503 where convert(char(10),saledt,120)='2005-03-01'
Declare @curDate char(10)
Declare @endDate char(10)
select @startDate = '2005/02/28',@endDate = '2005/03/02' -->>或者在此处直接更改起止日期:
select @curDate = @startDate
declare @kqstartdate datetime,@kqenddate datetime,@ts int
set @ts=DATEDIFF(day,@startdate,@enddate)
set @kqenddate = DATEADD(day, -1,@startdate)
set @kqstartdate = DATEADD(day, -@ts,@kqenddate)
********************************************************/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10315043/viewspace-498419/
,如需转载,请注明出处,否则将追究法律责任。