Solved

ntext uses 16 bytes.

Posted on 2011-02-15
6
1,116 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 175 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 150 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

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

Assisted Solution

by:Éric Moreau
Éric Moreau earned 175 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

726 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