471,092 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

ntext Question

Dear Group

I admit, this might be a very ignorant question.

BOL says about the ntext data type:
Variable-length Unicode data with a maximum length of 2^30 - 1
(1,073,741,823) characters.

I've stored a string consisting of around 45.000 characters in a ntext
field - done by copying the string in my txt document and pasting in
Enterprise Manager.

When I determine the datalength of the field in SQL Analyzer I get
2046.
Is this realistic? Is it bytes or the actual number of characters? It
seems incrrect to me..

Although, when I read the string with a DataReader based on a stored
procedure and save it in a string variable in my VB.NET application,
the string is truncated, although the variable can hold up to
approximately 2 billion Unicode characters according to MSDN.

I just wonder whether I've done something wrong or misunderstood
something on the SQL server side that causes this problem.

Thanks very much for your help!

Martin
Jul 20 '05 #1
2 3052
Martin (th************@hotmail.com) writes:
BOL says about the ntext data type:
Variable-length Unicode data with a maximum length of 2^30 - 1
(1,073,741,823) characters.

I've stored a string consisting of around 45.000 characters in a ntext
field - done by copying the string in my txt document and pasting in
Enterprise Manager.

When I determine the datalength of the field in SQL Analyzer I get
2046.
Is this realistic? Is it bytes or the actual number of characters? It
seems incrrect to me..


datalength() return the length in bytes, so it appears that only 1023
characters made it to the table through Enterprise Manager. EM is
poor tool for most of the functions it exhibits, and data entry is
one of them. Apparently there is a limitation.

If the document is only 46000 characters, you can write an insert
statement for it in Query Analyzer. However, QA can only handle 64KB
of text. I know, because I tried run an SQL statement with a 500 KB
long XML string the other day... I was able to get that working by
putting it all in a file with a third-party text editor, and run
the file from the command-line tool OSQL.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Hi Erland
Thanks very much for sharing your expertise.
Have a nice day :-)

M
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Derek Erb | last post: by
2 posts views Thread by Sileesh | last post: by
3 posts views Thread by =?Utf-8?B?ZGF2aWQ=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.