函数获取当前月的天数
CREATE FUNCTION [dbo].[GetMonthDays](@YY CHAR(4), @MM CHAR(8))
RETURNS INT
AS
BEGIN
DECLARE @Riqi DATETIME,@I INT
if @MM<12
begin
SET @MM=CONVERT(CHAR(5),CONVERT(INT,@MM)+1)
SET @Riqi = dateadd(day,-1,CONVERT(DATETIME,@YY+'-'+@MM+'-01'))
SET @I =CAST(datepart(day,@Riqi) AS INT)
end
else
SET @I =31
return @I
END
一点一滴 坚持,汇成知识的海洋~ 希望自己能进步!