-- =============================================
-- create scalar function (fn)
-- =============================================
if exists (select * 
       from   sysobjects 
       where  name = n'UDFExample')
    drop function UDFExample
go

/******************************************************************************

  UDFExample

  purpose     : This function serves as an example of good coding practices for the Transact5-SQL language

  author      : Martin Dupuis
  created     : July 1st, 2002

  history     :
    July 1st, 2002 - Martin Dupuis - creation of the udf


******************************************************************************/
create function UDFExample 
    (@FirstParam integer, 
     @SecondParam integer)
returns integer
as
begin
    declare @sum as int

    select @sum = @FirstParam + @SecondParam2

    return @sum
end
go
