| Login

Search this Blog


Links I like to keep around




Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Jun24

Written by:R Teachout
6/24/2008 9:04 PM

Have you ever faced the problem of assigning more than 8000 characters to varchar data type or more than 4000 characters to nvarchar data type? If your answer is yes, then I can understand your frustration due to this small limit.
Since SQL Server uses 8KB page to store data to disk therefore, it does not allow you more than 8000 characters in varchar or 4000 (2 Bytes per Unicode character) in nvarchar.

But wait, don’t get disappointed, Microsoft came up with Varchar(MAX), NVarchar(MAX) and VarBinary(MAX) data types in SQL Server 2005 which allows you to save upto 2GB in a single variable. The best part is that It allows you to use these data types as stored procedure parameters, internal variables etc.

So stop using TEXT and NTEXT data types because they are just there for backward computability and will be deprecated in next versions of SQL Server.

(Found this article on http://sqltips.wordpress.com/2007/05/28/use-varcharmaxnvarcharmax-instead-of-text-ntext/ and wanted to add it here for others to read!

Tags:

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel  

What we're really after is simply that people acquire a legal license for Windows for each computer they own before they move on to Linux or Sun Solaris or BSD or OS/2 or whatever.
-Bill Gates

Inspired by Nina