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

--create function [dbo].[fn_GetUlyanovskReestrTotalCost] (@RegisterID uniqueidentifier)
--returns decimal(10, 2)
--as
--begin

--return (
--	select
--		sum(isnull([SUM], 0))
--	from
--		[AKUZ].T_ULYANOVSK_REESTR_ITEM with(nolock)
--	where
--		UlyanovskReestrMain = @RegisterID
--)
--end
--GO