Brandon Lewis

Brandon Lewis

  • NA
  • 527
  • 125.8k

Out Parameter for User Defined Function?

Jul 21 2008 7:49 PM
Hello, Im just getting into SQL Server 2005 and the Transact SQL language and was wondering if there is any way to have an out parameter like C# has. Something like this:

public bool PhoneNumberIsValid(string phoneNumber, out string errorMsg)
{
   // Do some validation code, and if an error is encountered, assign an error message to the errorMsg parameter and return false.
}


Something like that, only for SQL. Im trying to handle some errors before they occur, but havent found any good solution for preemptive error catching and notification. Thanks!