Wednesday, March 21, 2012

Save xml in sql

Hi...

I want to save xml string in sql, but, i have problem, the length of the string is 19,000 - 24000 chars, and nVarChar can contain 4000 chars, and binary can contain 8000 chars...

so, how can i solve this?

thank you...

I generally use a text field for storing html/xml info

|||

Hi there,

Use datatype Object to store that info.

Convert it into bytes, and store it on that Objecto field.

To retrieve it, obtain the bytes from the SQL Server, and convert to string again. It's the same way you strore files like pictures, etc..

gonzzas

|||

HI

You can use ntext type to store the string.

|||

Hi,

Beside the above solutions, you also can focus on SQL(Yukon). It provides a rich set of tools for storing and manipulating XML in databases, without treating it as a blob of binary data or an arbitrary string. When you want XML, just use the xml data type, which is a fundamental part of the product.

The link may be helpful to you. http://msdn.microsoft.com/msdnmag/issues/04/02/XMLinYukon/default.aspx

Thanks.

No comments:

Post a Comment