Max size of varchar(max) in SQL Server 2000

杀马特。学长 韩版系。学妹 提交于 2020-01-02 00:53:10

问题


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?


回答1:


Varchar is 8000 and nvarchar is 4000.

Here's the varchar msdn reference:
http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx




回答2:


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).

The best explanation of all these details comes from Inside the Storage Engine: Anatomy of a page.




回答3:


As far as I remember it is 8000 Chars.

For Nvarchar it is 4000.




回答4:


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.



来源:https://stackoverflow.com/questions/2077747/max-size-of-varcharmax-in-sql-server-2000

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!