?
Solved

ntext uses 16 bytes.

Posted on 2011-02-15
6
Medium Priority
?
1,158 Views
Last Modified: 2012-05-11
ntext uses 16 bytes.

Does this mean that a one letter string and a 200 letter are both 16 bytes?
0
Comment
Question by:Mr_Shaw
6 Comments
 
LVL 13

Accepted Solution

by:
dwkor earned 700 total points
ID: 34898969
16 bytes is the pointer to the LOB page where data is actually stored. By default everything is stored "off page". You can change this behavior with text in row option: http://technet.microsoft.com/en-us/library/ms189087.aspx

I need to mention that ntext is obsolete data type. It's better to use nvarchar(max) now. This type (as long as varbinary) works/stores the data differently. For columns < 8000 bytes it tries to store data on the same page moving them to "row overflow" pages if row does not fit. For data >8000 bytes it stores that similarly to ntext.
0
 
LVL 6

Assisted Solution

by:MuffyBunny
MuffyBunny earned 600 total points
ID: 34898983
The following article
http://msdn.microsoft.com/en-us/library/aa175795%28v=sql.80%29.aspx

In this article, it states that "The actual storage size, in bytes, for ntext is two times the number of characters entered."

So the answer to your question would be no, a 1 letter string and a 200 letter string will not use the same amount of space.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 34899002
dwkor has the correct answer (a pointer)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mr_Shaw
ID: 34899034
What about MuffyBunny?
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 700 total points
ID: 34899057
it is true that ntext is twice bigger then text because it stores unicode.

but 16 bytes is the length of the pointer. 200 characters will never use as little as 16 bytes. it will use 16 + (200 * 2)
0
 

Author Closing Comment

by:Mr_Shaw
ID: 34899373
thanks... this will take a bit of thinking about :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question