Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 ntext vs text data types

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2005-03-10 : 18:38:42
We need to store texts of variable lengths in text fields and would like to understand the differences between ntext and text data types.

We may have some foreign data stored in those fields. I know that ntext fields take unicode characters. What foreign characters will text fields take?

Thanks in advance.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-10 : 20:08:34
Whatever is in the standard character set for your database's collation/code page.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-03-10 : 20:14:26
Be sure you also understand the ramifications of maintaining text/ntext data. If you don't store more than 8000 characters (4000 for Unicode), varchar/nvarchar is much easier to work with.

Be One with the Optimizer
TG
Go to Top of Page

RichardSteele
Posting Yak Master

160 Posts

Posted - 2005-03-10 : 20:20:49
Thanks. Where do I find that? Can I see the actual characters?
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-10 : 20:25:37
declare @c tinyint
set @c=1

while @c<255
begin
print char(@c)
set @c=@c+1
end
Go to Top of Page

RichardSteele
Posting Yak Master

160 Posts

Posted - 2005-03-10 : 20:51:19
Thanks. So, just to be clear, only the basic 255 ascii characters can be stored in text fields? Thanks.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-03-11 : 00:34:37
"basic 255 ascii characters"

Except that that depends on your collation - so what you get, mostly in the top 128 characters, may very well do you - and save you half of your memory and disk space in the process! (ntext/nvarchar uses twice as much as text/varchar, but I'm sure you know that)

Kristen
Go to Top of Page
   

- Advertisement -