What are the DisAdvantages of User Defined Functions?
Ajeet Mishra
We cannot use temporary tables inside the UDF.We cannot use Print command inside the UDF.We can't use the Insert, update and delete command inside the function. We can only use these commands on the table variable defined inside the function.We cannot use the try catch statement inside the function for the debugging purpose which makes it difficult to debug.We can't use transaction inside the function.We can't call the stored procedure from inside the function.We can't return multiple record sets from a function as we can do in case of Stored Procedure.
UDF that return non-deterministic values are not allowed to be called from inside UDF GETDATE is an example of a non-deterministic function. Every time the function is called, a different value is returned. Not every SQL statement or operation is valid within a function. The following lists enumerate the valid and invalid function operations: Valid: Assignment statements Control-flow statements Variable declarations SELECT statements that modify local variables Cursor operations that fetch into local variables INSERT, UPDATE, DELETE statement that act upon local table variablesInvalid: Built-in, nondeterministic functions such as GetDate() Statements that update, insert, or delete tables or views Cursor fetch operations that return data to the client