collate

PostgreSQL 9.1 using collate in select statements

做~自己de王妃 提交于 2019-12-03 04:06:52
I have a postgresql 9.1 database table, "en_US.UTF-8": CREATE TABLE branch_language ( id serial NOT NULL, name_language character varying(128) NOT NULL, branch_id integer NOT NULL, language_id integer NOT NULL, .... ) The attribute name_language contains names in various languages. The language is specified by the foreign key language_id. I have created a few indexes: /* us english */ CREATE INDEX idx_branch_language_2 ON branch_language USING btree (name_language COLLATE pg_catalog."en_US" ); /* catalan */ CREATE INDEX idx_branch_language_5 ON branch_language USING btree (name_language

Change collations of all columns of all tables in SQL Server

独自空忆成欢 提交于 2019-12-03 02:27:24
问题 I imported a database with some data to compare with another database. The target database has collation Latin1_General_CI_AS and the source database has SQL_Latin1_General_CP1_CI_AS . I did change the collation of the source database in general to Latin1_General_CI_AS using the SQL Server Management Studio. But the tables and columns inside remains with the old collation. I know that I can change a column using: ALTER TABLE [table] ALTER COLUMN [column] VARCHAR(100) COLLATE Latin1_General_CI

Change collations of all columns of all tables in SQL Server

落花浮王杯 提交于 2019-12-02 14:22:19
I imported a database with some data to compare with another database. The target database has collation Latin1_General_CI_AS and the source database has SQL_Latin1_General_CP1_CI_AS . I did change the collation of the source database in general to Latin1_General_CI_AS using the SQL Server Management Studio. But the tables and columns inside remains with the old collation. I know that I can change a column using: ALTER TABLE [table] ALTER COLUMN [column] VARCHAR(100) COLLATE Latin1_General_CI_AS But I have to do this for all tables and all columns inside. Before I know start to write a stored

sqlite3 on rails: create_table using collate nocase

孤街浪徒 提交于 2019-12-02 08:32:10
问题 Using rails 4.2.0 with ruby v2.3.0p0 I want to create indexes that are case insensitive since most of my searches are case insensitive and I don't want to have to do a full table search every time. So in my create_table migrations, I try adding lines such as: add_index :events, :name, :COLLATE => :NOCASE And when I migrate I get: == 20150515163641 CreateEvents: migrating ===================================== -- create_table(:events) -> 0.0018s -- add_index(:events, :submitter, {:COLLATE=>

sqlite3 on rails: create_table using collate nocase

限于喜欢 提交于 2019-12-02 03:20:47
Using rails 4.2.0 with ruby v2.3.0p0 I want to create indexes that are case insensitive since most of my searches are case insensitive and I don't want to have to do a full table search every time. So in my create_table migrations, I try adding lines such as: add_index :events, :name, :COLLATE => :NOCASE And when I migrate I get: == 20150515163641 CreateEvents: migrating ===================================== -- create_table(:events) -> 0.0018s -- add_index(:events, :submitter, {:COLLATE=>:NOCASE}) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

Use Collate in CONCAT

拥有回忆 提交于 2019-12-01 15:09:48
I was trying to concatonate 2 columns with a whitespace in between and got a collation error: SELECT DISTINCT p.PERSON_ID, p.ID_NUMBER, CONCAT(p.FULLNAMES, CONCAT(' ', p.SURNAME)) AS NAME, o.ORG_NAME, w.WARD_DESCRIPTION AS WARD, ess.DESCRIPTION AS SECTOR Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the concat operation The collation of both the offending columns in my database is: Latin1_General_CI_AS So then I was trying to collate the whitespace to this collation, but I have no idea how to do this. My attempt: CONCAT(p.FULLNAMES,

Use Collate in CONCAT

孤人 提交于 2019-12-01 14:46:37
问题 I was trying to concatonate 2 columns with a whitespace in between and got a collation error: SELECT DISTINCT p.PERSON_ID, p.ID_NUMBER, CONCAT(p.FULLNAMES, CONCAT(' ', p.SURNAME)) AS NAME, o.ORG_NAME, w.WARD_DESCRIPTION AS WARD, ess.DESCRIPTION AS SECTOR Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the concat operation The collation of both the offending columns in my database is: Latin1_General_CI_AS So then I was trying to

SQLite Query in non case sensitive alphabetical order [duplicate]

守給你的承諾、 提交于 2019-11-28 16:37:40
This question already has an answer here: How to use SQL Order By statement to sort results case insensitive? 3 answers All I want to do is grab the stuff in alphabetical order and ignore the capital letters. db.rawQuery("SELECT " + catName + " FROM "+tableName+" ORDER BY "+catName+" ASC COLLATE NOCASE;", null); This is the code I'm using above, but it always gives me an SQLite exception saying that COLLATE is a syntax error. android.database.sqlite.SQLiteException: near "COLLATE": syntax error: , while compiling: SELECT Artist FROM testTable COLLATE NOCASE ASC COLLATE goes before the order

How do I perform a case-sensitive search using LIKE?

a 夏天 提交于 2019-11-28 08:55:21
I'm trying to find records that contain a string of 6 or more alpha-numeric characters in uppercase. Some examples: PENDING 3RDPARTY CODE27 I'm using the following statement: SELECT Details FROM MyTable WHERE Details LIKE '%[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]%'; This is returning all records that contain any 6-or-more-letter word, regardless of case. I've added a COLLATE statement: SELECT Details FROM MyTable WHERE Details COLLATE Latin1_General_CS_AS LIKE '%[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]%'; This changes nothing. It still returns records with 6-or-more-letter

normalizing accented characters in MySQL queries

拟墨画扇 提交于 2019-11-27 23:34:21
I'd like to be able to do queries that normalize accented characters, so that for example: é, è, and ê are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to ' rené ', and I'd like to be able to match on it with both ' rene ' and ' rené '. I'm attempting to do this with the 'collate' clause in MySQL 5.0.8. I get the following error: mysql> select * from User where username = 'rené' collate utf8_general_ci; ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1' FWIW, my table was created with: CREATE TABLE `User` ( `id`