if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn_GetVisitCount]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn_GetVisitCount]
GO

--create function [dbo].fn_GetVisitCount (@VisitID uniqueidentifier)
--returns int
--as
--begin
--	declare @ret int

--	select @ret = count(*) from [AKUZ].T_DOCTOR_INSPECTION_RE with(nolock)
--		where DoctorInspection = @VisitID

--	return @ret + 1
--end