-- 꼼수임~
create proc select_maxday
@year varchar(10),
@month varchar(10)
as
begin
declare @maxDay int
if(@month >= '12')
set @maxDay = substring(convert(char(10), cast('20'+right('0'+cast(cast(right(@year,2) as int)+1 as varchar(2)), 2)+'-01-01' as datetime)-1, 20), 9,2)
else
set @maxDay = substring(convert(char(10), cast('20'+right(@year,2)+'-'+right('0'+cast(cast(@month as int)+1 as varchar(2)), 2)+'-01' as datetime)-1, 20), 9,2)
select @maxday
end
--다음으로 결과 확인.
select_maxday '2008', '07'
'知 > MSSQL' 카테고리의 다른 글
트렌젝션 kill (0) | 2009.05.31 |
---|---|
테이블 비우기 (0) | 2009.04.27 |
로그 파일(.ldf) 크기 줄이기 (0) | 2008.08.18 |
DB 백업하기 - 풀백업 쿼리문 (0) | 2008.07.31 |
MSSQL2005 저장프로시저 모니터하기 (0) | 2008.07.09 |