mysql 等效数据类型

2021-12-25 00:00:00 types mysql sql-server

我来自 SQL Server 背景.MySQL 中以下内容的等效数据类型是什么:

I'm coming from a SQL Server background. What would the equivalent data types be for the following in MySQL:

NVARCHAR - 支持所有语言的国际多字节字符

NVARCHAR - provides support for international, multi-byte characters for all languages

NVARCHAR(max) - 允许非常长的文本文档

NVARCHAR(max) - allows for very long text documents

推荐答案

Going by http://msdn.microsoft.com/en-us/library/ms186939.aspx,我会说

Going by http://msdn.microsoft.com/en-us/library/ms186939.aspx, I would say that

VARCHAR(n) CHARSET ucs2

是最接近的等价物.但是我没有看到很多人使用这个,更多的人使用:

is the closest equivalent. But I don't see many people using this, more often people use:

VARCHAR(n) CHARSET utf8

据我所知,utf8 和 ucs2 两个字符集都允许使用相同的字符,只是编码不同.所以任何一个都应该有效,我可能会选择后者,因为它使用得更频繁.

As far as I am aware, both charactersets utf8 and ucs2 allow for the same characters, only the encoding is different. So either one should work, and I would probably go for the latter since it is used more often.

MySQL 的 unicode 支持存在一些限制,这些限制可能适用于您的用例,也可能不适用.请参考http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html 有关 MySQL 的 unicode 支持的更多信息.

There are some limitations in MySQL's unicode support that may or may not apply to your use case. Please refer to http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html for more info on MySQL's unicode support.

相关文章