코드의이 라인은 당신에게 현재 올해 처음이자 마지막이었던 얻을 것이다.

SQL: SQL :

SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0),'First Day of the Year'
UNION
SELECT DATEADD(dd,-1,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))),'Last Day of the Year'

Results: 검색 결과 :
2008-01-01 00:00:00.000 First Day of the Year
2008-12-31 00:00:00.000 Last Day of the Year

 

Posted by 요지
,