[英]How I can obtain the collation of a specific table in a database?
How I can obtain the collation of a specific table in a database? 我如何获取数据库中特定表的排序规则? Is it possible that a table have different collation in db?
是否有可能表中的db具有不同的排序规则?
Collation at the table level is on a per column basis, so it is possible to have a collation different than the database. 表级别的排序是基于每列的,因此可以使排序规则与数据库不同。 If the collation is not defined at the column level, it defaults to the database collation setting.
如果未在列级别定义排序规则,则默认为数据库排序规则设置。
SQL Server 2000: SQL Server 2000:
SELECT c.name,
c.collation
FROM SYSCOLUMNS c
WHERE [id] = OBJECT_ID('your_table_name')
SQL Server 2005+: SQL Server 2005+:
SELECT c.name,
c.collation_name
FROM SYS.COLUMNS c
JOIN SYS.TABLES t ON t.object_id = c.object_id
WHERE t.name = 'your_table_name'
There is no such thing as a collation for a table. 没有表格的整理。
A database has a default collation (which defaults to the collation for the server). 数据库具有默认排序规则(默认为服务器的排序规则)。
The default collation for the database will be applied to any column you add to a table, UNLESS you explicitly specify a collation at the column level. 除非您在列级别显式指定排序规则,否则数据库的默认排序规则将应用于您添加到表中的任何列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.