t - sql核对和Varchar(max)

时间:2022-09-26 16:05:59

When u use Varchar(max), it is 8000 chars for a variable, and around 2^32 for a column, what is COLLATE and how it affects that?

当你使用Varchar(max),它是8000字符变量,和周围2 ^ 32列,整理和它如何影响是什么?

Thanks

谢谢

2 个解决方案

#1


3  

Collation deterines how SQL Server sorts and compares string data (which varchar variables and column values are).

排序决定了SQL Server如何排序和比较字符串数据(varchar变量和列值是)。

See here

在这里看到的

#2


1  

When you declare a column or a variable of varchar(max), it can take up to 2 GB of data and 2^31-1 characters. If you declare the column or variable as nvarchar, it can still only take 2 GB of data and (2^31-1) / 2 characters since each character takes up twice as much space. When you declare a varchar column or variable without the use of the COLLATE clause, the collation of the database is used. The ``COLLATE clause does not affect the capacity of the column or variable.

当你声明一个变量列或varchar(max),它需要2 GB的数据和2 ^还有字符。如果您将该列或变量声明为nvarchar,它仍然只需要2 GB的数据和(2 31-1)/ 2字符,因为每个字符占用的空间是原来的两倍。当您声明一个varchar列或变量而不使用COLLATE子句时,将使用数据库的排序。“COLLATE子句”不影响列或变量的容量。

#1


3  

Collation deterines how SQL Server sorts and compares string data (which varchar variables and column values are).

排序决定了SQL Server如何排序和比较字符串数据(varchar变量和列值是)。

See here

在这里看到的

#2


1  

When you declare a column or a variable of varchar(max), it can take up to 2 GB of data and 2^31-1 characters. If you declare the column or variable as nvarchar, it can still only take 2 GB of data and (2^31-1) / 2 characters since each character takes up twice as much space. When you declare a varchar column or variable without the use of the COLLATE clause, the collation of the database is used. The ``COLLATE clause does not affect the capacity of the column or variable.

当你声明一个变量列或varchar(max),它需要2 GB的数据和2 ^还有字符。如果您将该列或变量声明为nvarchar,它仍然只需要2 GB的数据和(2 31-1)/ 2字符,因为每个字符占用的空间是原来的两倍。当您声明一个varchar列或变量而不使用COLLATE子句时,将使用数据库的排序。“COLLATE子句”不影响列或变量的容量。