/****** Object:  UserDefinedFunction [dbo].[fnx_GetDispChildXml_HealthInfringementType]    Script Date: 21.10.2016 11:03:10 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fnx_GetDispChildXml_HealthInfringementType]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[fnx_GetDispChildXml_HealthInfringementType]
GO

--/****** Object:  UserDefinedFunction [dbo].[fnx_GetDispChildXml_HealthInfringementType]    Script Date: 21.10.2016 11:03:10 ******/
--SET ANSI_NULLS ON
--GO

--SET QUOTED_IDENTIFIER ON
--GO
--CREATE FUNCTION [dbo].[fnx_GetDispChildXml_HealthInfringementType](@HealthInfringementType [int])
--RETURNS @Defects TABLE (
--	[Split] [varchar](8) NULL
--) WITH EXECUTE AS CALLER
--AS 
--BEGIN
--	if @HealthInfringementType & 2 = 2 begin insert into @defects (split) values('1') end
--	if @HealthInfringementType & 4 = 4 begin insert into @defects (split) values('2') end
--	if @HealthInfringementType & 8 = 8 begin insert into @defects (split) values('3') end
--	if @HealthInfringementType & 16 = 16 begin insert into @defects (split) values('4') end
--	if @HealthInfringementType & 32 = 32 begin insert into @defects (split) values('5') end
--	if @HealthInfringementType & 64 = 64 begin insert into @defects (split) values('6') end
--	if @HealthInfringementType & 128 = 128 begin insert into @defects (split) values('7') end
--	if @HealthInfringementType & 256 = 256 begin insert into @defects (split) values('8') end
--	if @HealthInfringementType & 512 = 512 begin insert into @defects (split) values('9') end
-- RETURN 
--END
