Solved

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

Posted on 2003-11-28
12
514 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 9

Expert Comment

by:miron
Comment Utility
also, post result of the bcp version query

bcp -v

--cheers
0
 
LVL 9

Expert Comment

by:miron
Comment Utility
jlislo,

any progress...

--cheers
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:jlislo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed, with points refunded (125)

Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now