Solved

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

Posted on 2003-11-28
12
519 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL- GROUP BY 4 24
access to sql migration 5 24
Need age at date of document 5 17
T-SQL: problem comparing datetime 4 48
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

749 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