can we call a stored procedure within a function in sql query?

Posted by Rajendra.prasad under Sql Server on 5/12/2011 | Points: 10 | Views : 4506 | Status : [Member] | Replies : 2
Hi,
can we call a stored procedure within a function in sql query?

Regards,
Rajendra




Responses

Posted by: Ndebata on: 5/12/2011 [Member] Starter | Points: 25

Up
0
Down
Hi

Only functions and extended stored procedures can be executed from within a function.

Thanks,
Debata

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 12/8/2011 [Member] Silver | Points: 25

Up
0
Down

Please refer to: http://msdn.microsoft.com/en-us/library/aa175782(v=sql.80).aspx

--Function that encapsulates xp's and OPENXML
--creation of function udf_xml succeeds
Create function udf_xml(@XMLDoc varchar(8000))
Returns @t table(ProductID int, Quantity int)
as
begin
declare @iDoc int
Exec sp_xml_preparedocument @iDoc OUTPUT, @XMLDoc
INSERT @t
SELECT * FROM OPENXML(@idoc, '/ROOT/Order',0)
WITH (ProductID int, Quantity int)
Exec sp_xml_removedocument @iDoc
return
end
GO

Thanks,
Sanjay

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response