如何设置数据库默认编码?

时间:2021-03-27 00:24:57

How do I set the the default encoding of my local file SQL-Server database?

如何设置本地文件SQL-Server数据库的默认编码?

Thanks.

谢谢。

EDIT: Removed the UTF-8

编辑:删除了UTF-8

3 个解决方案

#1


5  

Assuming by encoding you mean collation, you can change the default for new databases like:

假设通过编码表示排序规则,您可以更改新数据库的默认值,例如:

alter database model collate SQL_Latin1_General_CP1_CI_AS

The change the collation of an existing database:

更改现有数据库的排序规则:

alter database YourDbName collate SQL_Latin1_General_CP1_CI_AS

The list of available collations is returned by a system function:

可用的排序规则列表由系统函数返回:

select * from fn_helpcollations()

#2


0  

SQL Server does not support UTF-8.

SQL Server不支持UTF-8。

Use nvarchar (UTF-16) if you don't mind using double space or varbinary if you don't need sort/indexing/comparison.

如果您不介意使用双空格或varbinary,请使用nvarchar(UTF-16),如果您不需要排序/索引/比较。

It may be supported in next release of SQL Server according to this post

根据这篇文章,它可能在下一版本的SQL Server中得到支持

#3


-3  

/*!40101 SET NAMES utf8 */

Something like that

这样的事情

#1


5  

Assuming by encoding you mean collation, you can change the default for new databases like:

假设通过编码表示排序规则,您可以更改新数据库的默认值,例如:

alter database model collate SQL_Latin1_General_CP1_CI_AS

The change the collation of an existing database:

更改现有数据库的排序规则:

alter database YourDbName collate SQL_Latin1_General_CP1_CI_AS

The list of available collations is returned by a system function:

可用的排序规则列表由系统函数返回:

select * from fn_helpcollations()

#2


0  

SQL Server does not support UTF-8.

SQL Server不支持UTF-8。

Use nvarchar (UTF-16) if you don't mind using double space or varbinary if you don't need sort/indexing/comparison.

如果您不介意使用双空格或varbinary,请使用nvarchar(UTF-16),如果您不需要排序/索引/比较。

It may be supported in next release of SQL Server according to this post

根据这篇文章,它可能在下一版本的SQL Server中得到支持

#3


-3  

/*!40101 SET NAMES utf8 */

Something like that

这样的事情