declare @start datetime declare @end datetime set @start = '2018-01-25' set @end = '2018-02-03' select dateadd(dd,num,@start) FROM (SELECT ROW_NUMBER() OVER (ORDER BY ID)-1 AS num FROM sysobjects) KK where dateadd(dd,num,@start) <=@end --2018-01-25 0…
var stime = '2018-07-25'; //开始日期 var etime = '2018-08-02'; //结束日期 getdiffdate(stime,etime); //获取两日期之间日期列表函数 function getdiffdate(stime,etime){ //初始化日期列表,数组 var diffdate = new Array(); var i=0; //开始日期小于等于结束日期,并循环 while(stime<=etime){ diffdate[i] = sti…
本文主要向大家介绍了SQLServer数据库之SQL Server 获取本周,本月,本年等时间内记录,通过具体的内容向大家展现,希望对大家学习SQLServer数据库有所帮助. datediff(week,zy_time,getdate())=0 //查询本周datediff(month,zy_time,getdate())=0 //查询本月本季:select * from table where datediff(qq,C_CALLTIME,getdate())=0前半年1-6,后半年7-12…