标签:
取月头月尾:
declare @someDay datetime,@firstDay datetime,@endDay datetime set @someDay=‘2015.2.2‘ set @firstDay=dateadd(month,datediff(month,0,@someDay),0) set @endDay=dateadd(month,datediff(month,-1,@someDay),-1) select @someDay,@firstDay,@endDay
亮点在这里:
declare @someDay datetime, @someDay2 datetime set @someDay =0 set @someDay2=-1 select @someDay,@someDay2
返回:
标签:
原文地址:http://www.cnblogs.com/icyJ/p/4561001.html