ALTER FUNCTION [dbo].[GetFiscalQuarters] ( @Asofpdate DATETIME )
RETURNS varchar(10)
BEGIN
DECLARE @vOutputDate varchar(10)
SET @vOutputDate = Convert(varchar(max),
(case when DATEPART(M,@Asofpdate) between 5 and 7 then 1 when DATEPART(M,@Asofpdate) between 8 and 10 then 2
when DATEPART(M,@Asofpdate) between 11 and 1 then 3 when DATEPART(M,@Asofpdate) between 2 and 4 then 4
end) ) + CONVERT(varchar(max), Year(@Asofpdate))
RETURN @vOutputDate
END
ALTER FUNCTION [dbo].[GetYearQuarters] ( @Asofpdate DATETIME )
RETURNS varchar(10)
BEGIN
DECLARE @vOutputDate varchar(10)
SET @vOutputDate = Convert(varchar,DATEPART(QUARTER,@Asofpdate)) + CONVERT(varchar, Year(@Asofpdate))
RETURN @vOutputDate
END
RETURNS varchar(10)
BEGIN
DECLARE @vOutputDate varchar(10)
SET @vOutputDate = Convert(varchar(max),
(case when DATEPART(M,@Asofpdate) between 5 and 7 then 1 when DATEPART(M,@Asofpdate) between 8 and 10 then 2
when DATEPART(M,@Asofpdate) between 11 and 1 then 3 when DATEPART(M,@Asofpdate) between 2 and 4 then 4
end) ) + CONVERT(varchar(max), Year(@Asofpdate))
RETURN @vOutputDate
END
ALTER FUNCTION [dbo].[GetYearQuarters] ( @Asofpdate DATETIME )
RETURNS varchar(10)
BEGIN
DECLARE @vOutputDate varchar(10)
SET @vOutputDate = Convert(varchar,DATEPART(QUARTER,@Asofpdate)) + CONVERT(varchar, Year(@Asofpdate))
RETURN @vOutputDate
END
No comments:
Post a Comment