XML truncated on client when using FOR XML...

  • Thread starter Thread starter Charlie@CBFC
  • Start date Start date
C

Charlie@CBFC

Hi:

I have a stored proc that returns an XML doc. Testing it in Query Analyzer,
it looks fine. However consuming it in C# application truncates xml string
when result is converted to string from an ExecuteScalar data command. May
have something with string conversion because looking at result in a
datatable column looks OK, but when converting (tbl.Rows[0][0].String()) it
gets truncated. Why?

Thanks,
Charlie
 
FOR XML returns XML data as a single-field text result with as many
rows required to contain all the data. It may be more than one row
and thus Rows[0][0] and ExecuteScalar will both truncate the data.

SqlCommand has a SQL-Server specific method ExecuteXmlReader designed
to handle FOR XML results.

HTH,

Sam
 
Back
Top