Skip to content
Advertisement

Tag: user-defined-functions

SQL Exit scalar function prematurely

In SQL, you can exit the stored procedure prematurely with RETURN statement. However, when I try to apply the same principle to the scalar function, it returns the error, since function needs to return something. How do I prematurely exit the scalar function the same way RETURN is used in the stored procedure? Thank you. Answer You can’t RAISERROR or

Table, Row valued UDFs in SQL Server

SQL Server (and some other databases) support a Table-value function. Is there a such thing as a Row-valued function — where based on a set of input values, a specific row would be returned, or is that type of function type not supported. If not, why isn’t it supported? The example SQL Server gives is: So a Row valued function

Advertisement