Scripting SQL Functions

  • When I use SQL EM to script all of my sql functions it does not script the functions with dependencies on other functions last. So for example if Function ufn_c is called by function ufn_a it will script ufn_a first then ufn_c.

    This causes a invalid object name error when I run the script.

    Is there any way to fix this besides manually modifying the script ?

  • I doubt there is a way. However, if you execute the whole script couple times in a row, it should run with no errors the second time (unless you drop ALL in the beginning).

    I think the cause could be that SQL Server does not know the dependencies of UDF on UDF.

    By the way, nesting UDF could be a "red flag" to design issues. There might be too much of business logic on the SQL Server side.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply