January 4, 2008 at 12:24 pm
I am new to SQL Server and have to select columns from a SQL Server 2000 table and create an .xml file of the selected columns.
I am not sure of the syntax or the code I need to write to accomplish this.
Any suggestions will be greatly appreciated.
January 7, 2008 at 5:25 am
I myself am on the same learning curve as you, though I have made good headway in my research. You could try these:
[Code]SELECT Customers.CustomerID, Orders.OrderID, Orders.OrderDate
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
ORDER BY Customers.CustomerID
[FOR XML [RAW | EXPLICIT]]
OR
[FOR XML AUTO, [XMLDATA]] [/Code]
January 8, 2008 at 2:47 am
January 8, 2008 at 3:02 am
Praja, do NOT "cut and paste" the code - it will definitely not work. Use only one of the options in brackets separated by "|".
[Code]SELECT Customers.CustomerID, Orders.OrderID, Orders.OrderDate
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
ORDER BY Customers.CustomerID
FOR XML [RAW | EXPLICIT | AUTO][/Code]
Use BOL / Google to find out the precise features of each option.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy