10-14-04, 12:11 #1Registered User
- Join Date
- Oct 2004
Unanswered: ODBC, SQL Server, "FOR XML" & Cursors error
Has anybody had any luck using the Microsoft SQLServer ODBC drivers (Driver version: 03.81.9030, ODBC version : 03.52)
to connect to a SQL Server 2000 database and passing in a SELECT with a FOR XML clause. I keep
getting Error [Microsoft][ODBC SQL Server Driver][SQL Server]The FOR XML clause is not allowed in a CURSOR statement
., State: 42000, Error: 6819.
Is there a work around (eg putting the select in a stored procedure) or am I missing something ?
I am using SQLExecDirect() to execute the statement.
Or could any one suggest a better way to retrieve data from a standard table in XML formated string?
10-14-04, 14:08 #2Registered User
- Join Date
- Jul 2003
- San Antonio, TX
If you are using a cursor or a loop (it may actually work in a loop, but methinks NOT), then create a stored procedure that contains just SELECT...FOR XML AUTO/RAW/whatever. But I don't see a point doing that because further processing of the data retrieved in XML format within a stored procedure is not supported. Check this site for general guidelines on using FOR XML clause:
http://msdn.microsoft.com/library/de...enxml_0alh.asp"The data in a record depends on the Key to the record, the Whole Key, and
nothing but the Key, so help me Codd."