블로그는 나의 힘!
[ Programing ]/Database2020. 12. 24. 12:38


DECLARE @now smalldatetime = GETDATE();
SELECT @now, 
CAST(CONVERT(varchar(8), DATEADD(mm, 1, DATEADD(DAY, 1-DAY(@now), @now)), 112) AS int)





-------------------------------------------

 

DECLARE @now smalldatetime = GETDATE();
DECLARE @now2 smalldatetime;
SET @now2 = CONVERT(varchar(8), DATEADD(mm, 1, DATEADD(DAY, 1-DAY(@now), @now)), 112);
SELECT @now, @now2

Posted by Mister_Q