:::: MENU ::::

Purpose of using Varchar(max)

  • Aug 24 / 2010
  • 0
Data Types, dbDigger, T-SQL Interview Questions

Purpose of using Varchar(max)

varchar and nvarchar may store maximum bytes up to 8000 and 4000 respectively. In SQL Server 2005 and onwards we have another parameter max for varchar or nvarchar as field length. It can be used as varchar(max) or nvarchar(max).
Actually it is better version of text, ntext and image data types of SQL Server 2000. It enables the DBMS to store about 2 GB of data in a comparable data type. You can hold this value in a variable and also can apply comparison and manipulation functions on this huge amount of data.
There were a lot of limitations while using text, ntext and image data types. These values do not allow to use several of string functions. But also be aware of the fact that this tremendous power of using such large data as a string may eat your resources. So use this power with care.>
So you should be using varchar(n) or nvarchar(n) for bytes up to 8000 or 4000 respectively. And for larger text options consider using max as varchar(max) or nvarchar(max).

Consult us to explore the Databases. Contact us