set QUOTED_IDENTIFIER ON
go
create FUNCTION [dbo].[fnQuarterString]
-- returns quarter in form of '3Q2000' to which specified date belongs.
(
@dtmDate datetime
)
RETURNS char(6) -- quater like 3Q2000
AS
BEGIN
RETURN ( DateName(q, @dtmDate) + '季度' + DateName(yyyy, @dtmDate))
END