vendredi 8 mai 2015

how to use openxml within a user defined function in sql server

I am running into problems. I have an XML structure that I parse using OPENXML within a stored procedure to retrieve parameters used to perform a query. This procedure was a base proc that a different stored procedure (procedure 2) is calling. Procedure 2 uses an insert-exec construct to get the data from the base procedure. This works great as long as we only call Procedure 2 or the base procedure.

My first problem is that I have a different procedure (procedure 3) that now needs to get the result from procedure 2 (I need the business rules that this procedure enforces), but cannot due to the message "An INSERT EXEC statement cannot be nested".

I then tried to take the base procedure and make it a table valued function, but when I execute it, I receive the message "Only functions and some extended stored procedures can be executed from within a function."

How do I get around one or both of these issues?

Thanks,

Aucun commentaire:

Enregistrer un commentaire