How to handle errors and exceptions in SQL Server User Defined Functions (UDF)

Last Reply on Mar 18, 2014 05:43 AM By Mudassar

Posted on Mar 17, 2014 05:00 AM


ALTER FUNCTION [dbo].[udfSEmailID](@EmpID int)

RETURNS varchar(25)

	Declare @Email varchar(25)  
	select @Email = Employee.EmpEmail from Employee where Employee.Empid=@EmpID
	return @Email


This is User define Scalar function, Can anybody plz help me how to handle error or exception while using above function using SqlServer 2008R2. Thanks


Posted on Mar 18, 2014 05:43 AM