I would like to know what is the maximum size of varchar
in SQL Server 2000. While I was googling somewhere it was written 8000 characters and somewhere it was written 8060 bytes. Which one is correct?
我想知道SQL Server 2000中varchar的最大大小是什么。当我在某处搜索时,它写了8000个字符,某处写了8060字节。哪一个是正确的?
4 个解决方案
#1
24
Varchar is 8000 and nvarchar is 4000.
Varchar是8000,nvarchar是4000。
Here's the varchar msdn reference:
http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx
这是varchar msdn参考:http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx
#2
11
A SQL Server data page has 8k: 8192 bytes. From this a portion is reserved for the page header, leaving 8060 bytes the maximum lnegth a single row can have. In a row, the varbinary(n), varchar(n) and nvarchar(n) types cannot exceed 8000 bytes, which means that varchar(8000) is the maximum Ascii length and nvarchar(4000) is the maximum Unicode length (since Unicode stores each character on 2 bytes).
SQL Server数据页有8k:8192字节。由此为页面标题保留一部分,留下8060字节,即单行可以具有的最大百分比。在一行中,varbinary(n),varchar(n)和nvarchar(n)类型不能超过8000个字节,这意味着varchar(8000)是最大的Ascii长度,而nvarchar(4000)是最大的Unicode长度(因为Unicode)将每个字符存储在2个字节上)。
The best explanation of all these details comes from Inside the Storage Engine: Anatomy of a page.
所有这些细节的最佳解释来自存储引擎内部:页面剖析。
#3
2
As far as I remember it is 8000 Chars.
据我记得它是8000 Chars。
For Nvarchar it is 4000.
对于Nvarchar,它是4000。
#4
2
The maximum size of varchar(max) is large (2GB or 2Gchars, I think). The maximum value you can specify for n in varchar(n) is 8000, and for nvarchar it's 4000.
varchar(max)的最大大小很大(我想2GB或2Gchars)。您可以在varchar(n)中为n指定的最大值为8000,对于nvarchar,它的最大值为4000。
#1
24
Varchar is 8000 and nvarchar is 4000.
Varchar是8000,nvarchar是4000。
Here's the varchar msdn reference:
http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx
这是varchar msdn参考:http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx
#2
11
A SQL Server data page has 8k: 8192 bytes. From this a portion is reserved for the page header, leaving 8060 bytes the maximum lnegth a single row can have. In a row, the varbinary(n), varchar(n) and nvarchar(n) types cannot exceed 8000 bytes, which means that varchar(8000) is the maximum Ascii length and nvarchar(4000) is the maximum Unicode length (since Unicode stores each character on 2 bytes).
SQL Server数据页有8k:8192字节。由此为页面标题保留一部分,留下8060字节,即单行可以具有的最大百分比。在一行中,varbinary(n),varchar(n)和nvarchar(n)类型不能超过8000个字节,这意味着varchar(8000)是最大的Ascii长度,而nvarchar(4000)是最大的Unicode长度(因为Unicode)将每个字符存储在2个字节上)。
The best explanation of all these details comes from Inside the Storage Engine: Anatomy of a page.
所有这些细节的最佳解释来自存储引擎内部:页面剖析。
#3
2
As far as I remember it is 8000 Chars.
据我记得它是8000 Chars。
For Nvarchar it is 4000.
对于Nvarchar,它是4000。
#4
2
The maximum size of varchar(max) is large (2GB or 2Gchars, I think). The maximum value you can specify for n in varchar(n) is 8000, and for nvarchar it's 4000.
varchar(max)的最大大小很大(我想2GB或2Gchars)。您可以在varchar(n)中为n指定的最大值为8000,对于nvarchar,它的最大值为4000。