Does H2 support a collation defintion for one single column?

社会主义新天地 提交于 2019-12-24 03:54:31

问题


I want to make a single H2 column in a H2 database to have a other collation (case insensitive) then the other columns (that are case sensitive).

In MySQL I would do this:

ALTER TABLE users MODIFY login VARCHAR(255) COLLATE utf8_general_ci

Is there a similar feature in H2?


回答1:


H2 only supports one collation per database (via SET COLLATION statement).

What it does support is a case-insensitive data type, VARCHAR_IGNORECASE. Internally, this data type is using String.compareToIgnoreCase. This may or may not work for your use case.




回答2:


From H2 reference guide:

ALTER TABLE users ALTER COLUMN login VARCHAR_IGNORECASE(255)


来源:https://stackoverflow.com/questions/21884157/does-h2-support-a-collation-defintion-for-one-single-column

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