Solved

ntext uses 16 bytes.

Posted on 2011-02-15
6
1,124 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

729 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