-- ============================================= -- create scalar function (fn) -- ============================================= if exists (select ROUTINE_NAME, ROUTINE_TYPE from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = N'' and ROUTINE_TYPE = N'FUNCTION' drop function dbo. go /****************************************************************************** dbo. purpose : author : created : history : - - creation of the udf ******************************************************************************/ create function dbo. (<@param1, sysname, @p1> , <@param2, sysname, @p2> ) returns as begin -- eg. -- declare @sum as int -- select @sum = @p1 + @p2 -- return @sum end go