Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

For XML output is missing at the end of the line.

Posted on 2003-11-28
12
518 Views
Last Modified: 2013-11-19
I did a "select * from dbo.Employees FOR XML AUTO, XMLDATA"
The output of each line is incomplete, so when I output to file is not a good XML doc. Help!!!

Thanks.

Jammy

--Sample output
<Schema name="Schema6" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"><ElementType name="dbo.Employees" content="empty" model="closed"><AttributeType name="EmployeeID" dt:type="i4"/><AttributeType name="LastName"
 Colorado State University in 1970.  She also completed &quot;The Art of the Cold Call.&quot;  Nancy is a member of Toastmasters International." ReportsTo="2" PhotoPath="http://accweb/emmployees/davolio.bmp"/><dbo.Employees xmlns="x-schema:#Schema6" Employ
Address="4110 Old Redmond Rd." City="Redmond" Region="WA" PostalCode="98052" Country="USA" HomePhone="(206) 555-8122" Extension="5176" Photo="dbobject/dbo.Employees[@EmployeeID='4']/@Photo" Notes="Margaret holds a BA in English literature from Concordia Co
es Professional.&quot;  He is fluent in Japanese and can read and write French, Portuguese, and Spanish." ReportsTo="5" PhotoPath="http://accweb/emmployees/davolio.bmp"/><dbo.Employees xmlns="x-schema:#Schema6" EmployeeID="7" LastName="King" FirstName="Rob
erman." ReportsTo="5" PhotoPath="http://accweb/emmployees/davolio.bmp"/>
0
Comment
Question by:jlislo
  • 5
  • 5
12 Comments
 
LVL 9

Expert Comment

by:miron
ID: 9839921
did you try

bcp "select * from dbo.Employees FOR XML AUTO, XMLDATA" queryout c:\test.xml -T -S <servername>

or

bcp "select * from dbo.Employees FOR XML AUTO, XMLDATA" queryout c:\test.xml -S <servername> -U <user_name> -P <'password'>

do not hesitate to post if you meet any difficulties.

--cheers
0
 

Author Comment

by:jlislo
ID: 9840058
I try

bcp "select * from dbo.Employees FOR XML AUTO, XMLDATA" queryout "c:\test.xml" -S"Myserver" -U"sa" -P"sa"

I got

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'queryout'.

Any idea?

Thanks

0
 
LVL 9

Expert Comment

by:miron
ID: 9840150
how about this one
bcp "select * from Northwind.dbo.Employees FOR XML AUTO, XMLDATA" queryout  c:\test.xml  -c -S  Myserver -U sa -P sa
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 9

Expert Comment

by:miron
ID: 9840415
also, post result of the bcp version query

bcp -v

--cheers
0
 
LVL 9

Expert Comment

by:miron
ID: 9840928
jlislo,

any progress...

--cheers
0
 

Author Comment

by:jlislo
ID: 9844383
Same error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'queryout'.

Something is missing here.
0
 

Author Comment

by:jlislo
ID: 9844433
I think we are off track now. I try to find out why the output is incomplete (broken XML tags) Thanks

 
0
 
LVL 9

Expert Comment

by:miron
ID: 9846388
this should help

C:\>echo.^</root^>>> c:\test1.xml
C:\>type C:\test.xml >> c:\test1.xml
C:\>echo.^<root^>> c:\test1.xml
C:\>bcp "select * from Northwind.dbo.Employees FOR XML AUTO, XMLDATA" queryout  c:\test.xml  -c -S  Myserver -U sa -P sa

--cheers
0
 

Author Comment

by:jlislo
ID: 9847272
Miron,

Thank you for your help. Again my goal is to find out "Why the output is incomplete (broken XML tags)?" Output to text is not the key.

0
 

Author Comment

by:jlislo
ID: 9847606
Please read "SELECT...FOR XML AUTO Results Are Separated into Lines of 2033 Chars with ODBC" This article was previously published under Q275583

http://support.microsoft.com/default.aspx?scid=kb;en-us;275583&Product=sql2k

I think I found the answer
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 9885929
PAQed, with points refunded (125)

Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question