IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fn_AraToplam]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN 
DECLARE @SQL VARCHAR(4000) = '
create function [dbo].[fn_AraToplam]
( @Adet  float = 0.0,
  @Fiyat float = 0.0
) RETURNS float 

as

BEGIN

  /* NULL Kontrol */
  set @Adet  = IsNull( @Adet,
                       0
                     )
  set @Fiyat = IsNull( @Fiyat,
                       0
                     )

  return dbo.fn_RoundBanker( @Adet * @Fiyat, 2 ) 

END
'

EXEC(@SQL)
END
