Bogdan, am citat artocolul de pe MSDN pentru ca "listeaza" niste limitari ale functiilor, si anume:
"#
Functions can't execute stored procedures. A function can only execute
functions and some xp's, but not sp's. This limitation immediately
disqualifies function as a candidate for solving use cases 1 and 3.
# Functions can't create temporary or any tables. In order to return a
result set of an xp, a function must be able to store the result set
somewhere. Tables are a natural choice. Unfortunately, functions can't
change the global database state. This includes the restriction of
creating any temporary or permanent tables that will indeed change the
global database state.
# Functions can't access temporary tables. Even if there were a
pre-created global temporary table, SQL Server still disallows
inserting data to this or any existing temporary table from within a
function.
# Functions can't insert into an existing table. Another even more
compromising idea is to create a permanent table outside of a function.
However, inserting into an existing permanent table from within a
function is considered changing global database state as well."
Ce-i
drept, articolul nu este 100% "la obiect", iar lista de limitari o
gasesti mai "la coada". Imi cer scuze...
Trebuia sa precizez asta
dintru inceput.