Solved

ntext uses 16 bytes.

Posted on 2011-02-15
6
1,089 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
What about MuffyBunny?
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 175 total points
Comment Utility
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
Comment Utility
thanks... this will take a bit of thinking about :)
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In this article I will describe the Backup & Restore 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.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

771 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

15 Experts available now in Live!

Get 1:1 Help Now