RE: Exporting to an XML file

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



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?
.



Relevant Pages

  • RE: Exporting to an XML file
    ... "TLuebke" wrote: ... SELECT cust_ID AS id, LASTNAME AS lname, FIRSTNAME AS fname ... I see there are several approaches to creating XML files. ... quickest and least complex method to make a simple XML in the required format? ...
    (microsoft.public.sqlserver.xml)
  • RE: Exporting to an XML file
    ... SELECT cust_ID AS id, LASTNAME AS lname, FIRSTNAME AS fname ... "TLuebke" wrote: ... I see there are several approaches to creating XML files. ... quickest and least complex method to make a simple XML in the required format? ...
    (microsoft.public.sqlserver.xml)
  • Exporting to an XML file
    ... My first time exporting XML via SQL 2005. ... Searching the net I found a proc ... rtrimAS Fname FROM web_met for xml auto', ... quickest and least complex method to make a simple XML in the required format? ...
    (microsoft.public.sqlserver.xml)
  • Re: Sane Syntax
    ... vital role in the future of TeX but we need some more human friendly ... Generating well formed LaTeX2e documents from XML ... Another approach is to convert existing documents to XML format and go ... TEI, together with DocBook, are the two ...
    (comp.text.tex)
  • Re: XHTML vs HTML
    ... to be the predominant type of HTML used on the web for many years yet. ... First, it is XML. ... XHTML is also ... transformed using XSL from and into virtually *any* other data format. ...
    (microsoft.public.frontpage.programming)