SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Unknown token received from SQL Server
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 04/24/2002 :  11:17:16  Show Profile  Visit MichaelP's Homepage
When Running a query that has "FOR XML AUTO" at the bottom in Query Analyzer, I'm getting this error just after it shows my string of XML. This error is in the data windows just below teh result set.

[Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Server

I started getting this when I re-arranged some fields. What could be causing this? I can post the query if needed, but it's rather large.

Michael





Edited by - michaelp on 04/24/2002 11:17:48

BlackDog
Starting Member

18 Posts

Posted - 10/18/2002 :  11:24:22  Show Profile
Does anyone have an answer for this? I'm having the same issue, although it's with XML AUTO as well as XML RAW.

Go to Top of Page

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 10/18/2002 :  11:27:58  Show Profile  Visit MichaelP's Homepage
Wish I had an answer for ya, but I got away from "FOR XML" in SQL Server. Sorry!

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

BlackDog
Starting Member

18 Posts

Posted - 10/18/2002 :  11:58:02  Show Profile
Define "Got away". Is there another option within SQL server for outputing XML?

Go to Top of Page

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 10/18/2002 :  12:03:12  Show Profile  Visit MichaelP's Homepage
I was testing some things when I posted this question. I've since stopped using FOR XML queries in SQL Server.

There are a few ways around getting XML data out of SQL Server.

ADO
1. Run a stored proc, populate an ADO recordset with the data, and save the recordset as XML
rs.Save("c:\myxmlfile.xml", 2) '2 is a constant for ADO XML or something like that

ADO.Net
2. Run a stored proc, populate a dataset, and serialize the Dataset to XML.

Can you explain what you are trying to do with XML? Maybe there's another way to do what you are trying to do.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

robvolk
Most Valuable Yak

USA
15559 Posts

Posted - 10/18/2002 :  12:03:31  Show Profile  Visit robvolk's Homepage
Since it seems to be an ODBC problem, maybe updating your MDAC components might fix it. Get the latest here:

http://www.microsoft.com/data/download.htm

BTW, what kind of data is being returned in the XML? I imagine that Unicode data might be part of the problem. If you have any nchar/nvarchar/ntext columns in the output, try removing them and see if it fixes it. Same applies for bit, binary/varbinary, and image data types.

Go to Top of Page

BlackDog
Starting Member

18 Posts

Posted - 10/18/2002 :  12:21:04  Show Profile
Boy, am I stumped! I'll check into my MDAC, but I've discovered that if I use QA and have Show Execution Plan on, I get very unpredictable results, including this error. If I remove columns from the select list (looking into the datatype issue rob mentioned), I can sometimes get no results at all. So, as long as I have Show Execution Plan off, it works fine.

As to why I'm outputting XML, this application was built bass ackwards and the UI has already been completed. It is expecting XML as the data source, so I started messing around with FOR XML.

Using ADO.NET to create the XML is a good suggestion. Any idea on what the performance difference is between using FOR XML and serializing the dataset in ADO.NET?

Go to Top of Page

robvolk
Most Valuable Yak

USA
15559 Posts

Posted - 10/18/2002 :  12:25:55  Show Profile  Visit robvolk's Homepage
It will probably work out about the same. If SQL Server generates the XML, it will have added "bloat" that will take longer to transmit over the network. However, the web server or client computer will only need to receive the data. With ADO.Net, there would be less network traffic but more client CPU cycles to XML-ize the data.

Go to Top of Page

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 10/18/2002 :  12:27:07  Show Profile  Visit MichaelP's Homepage
FOR XML is probably faster, but probably not by too much. It will probably mean less network traffic. I'm not experienced enough with ADO.net yet to tell you exactly.

If it works and FOR XML doesn't, I'd say go for it.

Could I have used probably more in this post? Probably not :)

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

BlackDog
Starting Member

18 Posts

Posted - 10/18/2002 :  12:34:30  Show Profile
Thanks. I'll do some testing and see which is best for my situation.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000