Hi.
I'm using MSDE 2000. Is there a way to get a query result in a 'readabe'
XML format from command line?
I found the option 'FOR XML', however this produced something that is
not really XML. E.g.:
SELECT * FROM dbo.master FOR XML
Thanks and best regards,
Dezo
You can execute SQL queries to return results as XML rather than standard
rowsets. These queries can be executed directly or from within stored
procedures. To retrieve results directly, you use the FOR XML clause of the
SELECT statement, and within the FOR XML clause you specify an XML mode:
RAW, AUTO, or EXPLICIT.
For example, this SELECT statement retrieves information from Customers and
Orders table in the Northwind database. This query specifies the AUTO mode
in the FOR XML clause:
SELECT Customers.CustomerID, ContactName, CompanyName,
Orders.CustomerID, OrderDate
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
AND (Customers.CustomerID = N'ALFKI'
OR Customers.CustomerID = N'XYZAA')
ORDER BY Customers.CustomerID
FOR XML AUTO
The output will be in the xml format .
This posting is provided "AS IS" with no warranties, and confers no rights.
No comments:
Post a Comment