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

--create function [dbo].[fn_GetUlyanovsrItemCount] (@RegisterID uniqueidentifier)
--returns int
--as
--begin

--return (
--	select
--		count(*)
--	from
--		[AKUZ].T_ULYANOVSK_REESTR_ITEM with(nolock)
--	where
--		UlyanovskReestrMain = @RegisterID
--)
--end
--GO