Re: Select Aggregate out of Stored Proc

Tech-Archive recommends: Fix windows errors by optimizing your registry



Maybe this simple code can help (you need Notrhwind sample database to
execute the code):

USE Northwind
GO

CREATE PROC dbo.uspReturnEmployeesXML2
@doc XML OUT
AS
SET @doc =
(SELECT
EmployeeID,
FirstName,
LastName
FROM dbo.Employees Employee
FOR XML AUTO, ELEMENTS, ROOT('root'), TYPE)
GO

-- Execute this procedure and count employees
DECLARE @doc XML
EXEC dbo.uspReturnEmployeesXML2 @doc OUT
SELECT count(*) AS [Number of employees]
FROM @doc.nodes('/root/Employee/EmployeeID[1]') AS T(c)

It seems you can not simply pass xml just by selecting and not using output
parameter.

--
Regards
Pawel Potasinski
[http://www.potasinski.pl]


U¿ytkownik "Michael Morse" <MichaelMorse@xxxxxxxxxxxxxxxxxxxxxxxxx> napisa³
w wiadomo¶ci news:815B18B7-5FD3-4FC6-96A8-E674B69E6C0F@xxxxxxxxxxxxxxxx
Hi All,

I have a stored proc that returns an xml document using a query with XML
EXPLICIT. What I would like to do is something like this:

select Count(/root/Employee/EmployeID) from exec MyProcName. Is there a
way
to do this? My proc returns excellent detail data but I would like to get
summary data out of it.

Thanks for the help.


.



Relevant Pages

  • Re: Is it safe to open a text file in Internet Explorer?
    ... "Download it to your disk, change the extension, then Send To ... an .xml extension you get "The XML page cannot be displayed."." ... I've read, re-read, Googled, and MSN searched -- MSN search is ... way that this can actually execute anything. ...
    (microsoft.public.security)
  • my first Tck/Tk program... and an XML question
    ... program which takes an XML Schema file, ... a basic XML tree and allows the user to save it. ... proc open_schema { ...
    (comp.lang.tcl)
  • Re: SQLXML - desperately need help..
    ... I think it is a difficult task to do it in a single explicit for xml qury. ... -- sample navigation table id is a fk fro customer ... exec spGenerateOneCustomer 1 ... You can execute several sp in a xml query tamplate (but I didnot tried it ...
    (microsoft.public.sqlserver.xml)
  • Re: SQL StoredProc Help
    ... > Hai Boss Hog, ... > The XML i use is like this.. ... > alter PROC CSP_INSERTNEWOWNERS ... > DECLARE @IDOC INT ...
    (microsoft.public.sqlserver.xml)
  • Memory allocation question with NuSOAP and XML parsing
    ... I have a memory allocation problem in PHP using NuSOAP and the built in XML ... The code below is called in a loop and executed about 1900 times ... I only needed it to execute another 240 times, ... die('Cannot create an XML parser handle.'); ...
    (alt.php)