all groups > sql server programming > april 2007 >
You're in the

sql server programming

group:

select ntext with length greater than 8000



select ntext with length greater than 8000 czl1129 NO[at]SPAM gmail.com
4/16/2007 9:54:45 PM
sql server programming: Maybe I'm missing something here. It seems what I'm trying to do is
pretty simple. I'm trying to query a database field with data type
ntext, and the content is greater than 8000 in length. I'm using .NET
1.1 framework to run a query.

SqlCommand cmd = new SqlCommand("SELECT message_body from tblMessages
where id = 1", conn);
conn.open();
String s = (string) cmd.ExecuteScalar();
Console.Write(s.length)

The full length of the text is about 8200, but the most i can ever
query out is 8000. Can someone tell me why? I know i have the full
length inside the database, because i can get the whole thing through
Query Analyser.
Re: select ntext with length greater than 8000 Stefan Nilsson
4/17/2007 12:00:00 AM
Seems it gets truncated on the application side then, make sure you use a
datatype in your application that can hold nText and also if you use some
kind of control like textbox check so it's not the control thet trunkate it.

-Stefan-

<czl1129@gmail.com> skrev i meddelandet
news:1176785685.445099.11030@l77g2000hsb.googlegroups.com...
[quoted text, click to view]
Re: select ntext with length greater than 8000 Mary Chipman [MSFT]
4/17/2007 12:26:20 PM
You don't say what version of SQL Server you are running. Here's a
link to obtaining BLOBs from SQLS 2000
http://msdn2.microsoft.com/en-us/library/87z0hy49(vs.80).aspx and
here's one for large value types in SQLS 2005
http://msdn2.microsoft.com/en-us/library/a1904w6t(VS.80).aspx.

--Mary

[quoted text, click to view]
Re: select ntext with length greater than 8000 czl1129 NO[at]SPAM gmail.com
4/18/2007 11:21:20 PM
[quoted text, click to view]


Sorry I had a brain fart. The above code does work for SQL2000, i just
had it pointed to the wrong DB. :-)
Re: select ntext with length greater than 8000 Michael Emmons
4/24/2007 1:36:36 PM
Have you tried to CAST it to a VARCHAR(max)?

[quoted text, click to view]

AddThis Social Bookmark Button