

“I want to execute a stored procedure from within a user-defined function, but I keep running into errors in the syntax.Is there a workaround that lets me use the GETDATE function?” “I want to call the GETDATE system function from within a user-defined function, but I’ve read you cannot do this.Are there steps we can take to fix this?”

Ever since I incorporated the function into the queries, performance has nosedived. “I created a scalar function that’s used in multiple queries, some of which can return millions of rows.“I’m creating a user-defined function and want to specify a default value for an input parameter.“I’ve heard you can use a function to parameterize a view, but I don’t see how you can incorporate a function into a view definition in such a way to support parameters.Is there an effective way to invoke the function for each row in the result set?” However, when I try to join the function to the target table in the query’s FROM clause, I receive an error. “I created a table-valued function that I want to apply to a column in each row returned by the query.Is there a way to stop the function from being executed when a NULL is passed in as a parameter value?” “I’m creating a scalar function that will be used against a column that contains multiple NULL values.TSQL User-Defined Functions: Ten Questions You Were Too Shy To Ask - Simple Talk
