Solved

ntext uses 16 bytes.

Posted on 2011-02-15
6
1,098 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 69

Expert Comment

by:Éric Moreau
ID: 34899002
dwkor has the correct answer (a pointer)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

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.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now