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