RE: Exporting to an XML file
- From: Bob <Bob@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 May 2009 03:34:02 -0700
Try this SQL, instead of yours:
SELECT cust_ID AS id, LASTNAME AS lname, FIRSTNAME AS fname
FROM #web_met
FOR XML RAW, ROOT('root')
HTH
wBob
"TLuebke" wrote:
My first time exporting XML via SQL 2005. Searching the net I found a proc.
but it doesn't format the file correctly
Running this:
sp_makewebtask @outputfile = 'c:\temp\myxmlfile.xml',
@query = 'SELECT rtrim(cust_ID) AS "Role ID", rtrim(LASTNAME) AS LName,
rtrim(FIRSTNAME) AS Fname FROM web_met for xml auto',
@templatefile = 'c:\temp\template.tpl'
Produces this:
<?xml version="1.0"?>
<root><web_met Role_x0020_ID="11111111" LName="Boxer" Fname="Ima"/><web_met
Role_x0020_ID="22222222" LName="Louis" Fname="Joe"/>
<root>
What I need is this:
<?xml version="1.0"?>
<root>
<row id="11111111" lname="Boxer" fname="Ima"/>
<row id="22222222" lname="Louis" fname="Joe"/>
<root>
I see there are several approaches to creating XML files. What is the
quickest and least complex method to make a simple XML in the required format?
- Follow-Ups:
- RE: Exporting to an XML file
- From: TLuebke
- RE: Exporting to an XML file
- References:
- Exporting to an XML file
- From: TLuebke
- Exporting to an XML file
- Prev by Date: Exporting to an XML file
- Next by Date: RE: Exporting to an XML file
- Previous by thread: Exporting to an XML file
- Next by thread: RE: Exporting to an XML file
- Index(es):
Relevant Pages
|