laubenth (12/8/2008)
ishaan99 (12/8/2008)
Has anyone tried calling a stored procdure from a user defined function. I have a procedure as Proc_XXX with 7 parameters if i do exec Proc_XXX(null,null,null,null,null,'1/1/1998','1/1/2007') i am getting the result set. Is it possible to have the same results when calling thru a function .call Proc_XXX(null,null,null,null,null,'1/1/1998','1/1/2007')
any help on this will be greatly appreciated. TIA
Not sure how you feel about calling functions from functions but you could create this
Func_XXX(.....) Insert current proc code here making the proc a proper function
Proc_XXX(.....) Select * From Func_XXX(....)
Use Func_XXX from your other function.
If the code contains any insert/update/delete statements to permanent tables (e.g. not table variables and not temporary tables), it isn’t possible. Inside a function you can not modify data and can not execute stored procedure.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/