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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ntext Vs nvarchar

Author  Topic 

hasanali00
Posting Yak Master

207 Posts

Posted - 2005-04-07 : 05:34:00
I am developing a Product table. In order to store product description, should I use nvarchar ot ntext.

What are the benefits of using ntext compared with nvarchar and vice versa??

I am not sure what the exact size of the description is going to be for the products.
thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-07 : 06:16:49
if your description will be under 4000 char (the limit for nvarchar) then use that.
else you have no choice but to use ntext. maybe if you put 2 columns desc1 and desc2 each with 4000 limit
and split the longer values. if the only thing you're going to do is insert it and display it you can go with ntext.
ntext is harder to work with.


Go with the flow & have fun! Else fight the flow
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-04-07 : 19:48:36
That really would not be very useful, because if the first column is filled with 4000 nvarchar, you would be very close to the rowsize limit of 8060 bytes per row, because nvarchar is 2 bypes per character.

quote:
Originally posted by spirit1
...maybe if you put 2 columns desc1 and desc2 each with 4000 limit...


CODO ERGO SUM
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-07 : 22:56:08
true. but if i had to do it this way (why is another question) i'd put them into another table.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-07 : 23:34:30
if the product description does not contain Unicode character(s)then use varchar to make life simpler for you without worrying extra 2 bytes,

if yes,
a. if length exceeds the limit for varchar, then nvarchar, use ntext (though as spirit mentioned, there are special storage and retrieval procedures not the usual select, update)
b.otherwise use nvarchar

HTH

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -