1 2 3 4 5 6 7 8 9 | DECLARE @IDATE varchar(8) SET @IDATE = '20090102' /* 말일구하기 */ SELECT Convert(Varchar, DATEADD(DAY,-DATEPART(DD,DATEADD(MONTH,1,@IDATE)),DATEADD(MONTH,1,@IDATE)), 112) /* 초일구하기 */ SELECT Convert(Varchar, DATEADD(DAY,1,DATEADD(DAY,-DATEPART(DD,@IDATE),@IDATE)), 112) | cs |