SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE FUNCTION [kalender].[boquarter] (@Datum AS DATE)
RETURNS DATE
AS 

BEGIN
   RETURN datefromparts(year(@Datum), ((datepart(qq, @Datum) - 1) * 3) + 1, 1)
END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
