diff --git a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.out b/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.out deleted file mode 100644 index 44df24f059..0000000000 --- a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.out +++ /dev/null @@ -1,71 +0,0 @@ -------------------- CI_AI ---------------------- -DROP TABLE test_like_for_AI_prepare_t6_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t7_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t13_1_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t13_2_ci; -GO - -DROP TABLE test_like_for_AI_prepare_employee_CI_AI; -GO - -------------------- CS_AI ---------------------- -DROP TABLE test_like_for_AI_prepare_t1_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t6_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t7_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t13_1_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t13_2_cs; -GO - -DROP TABLE test_like_for_AI_prepare_employee_CS_AI; -GO - --- GENERIC -- -DROP TABLE test_like_for_AI_prepare_escape; -GO - -DROP TABLE test_like_for_AI_prepare_max_test; -GO - -DROP TABLE test_like_for_AI_prepare_chinese; -GO - --- TESTS for remove_accents_internal -DROP FUNCTION test_like_for_AI_prepare_function; -GO - -DROP VIEW test_like_for_AI_prepare_view; -GO - -DROP PROCEDURE test_like_for_AI_prepare_procedure; -GO - - -DROP TABLE test_like_for_AI_prepare_t1_ci; -GO - --- TESTS FOR INDEX SCAN -DROP INDEX c1_idx ON test_like_for_AI_prepare_index; -GO - -DROP INDEX c2_idx ON test_like_for_AI_prepare_index; -GO - -DROP TABLE test_like_for_AI_prepare_index; -GO - -DROP TABLE test_babel_5006; -GO diff --git a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-prepare.out b/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-prepare.out deleted file mode 100644 index 64be8d9235..0000000000 --- a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-prepare.out +++ /dev/null @@ -1,454 +0,0 @@ - -------------------- CI_AI ---------------------- -CREATE TABLE test_like_for_AI_prepare_t1_ci ( - col NVARCHAR(50) COLLATE Latin1_General_CI_AI, - col_v VARCHAR(50) COLLATE Latin1_General_CI_AI, - col_t TEXT COLLATE Latin1_General_CI_AI, - col_ntext NTEXT COLLATE Latin1_General_CI_AI, - col_c CHAR(50) COLLATE Latin1_General_CI_AI, - col_nchar NCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t1_ci (col, col_v, col_t, col_ntext, col_c, col_nchar) -VALUES - ('café', 'café', 'café', 'café', 'café', 'café'), - ('jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño'), - ('résumé', 'résumé', 'résumé', 'résumé', 'résumé', 'résumé'), - ('naïve', 'naïve', 'naïve', 'naïve', 'naïve', 'naïve'), - ('Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata'), - ('Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo'), - ('TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO'), - ('película', 'película', 'película', 'película', 'película', 'película'), - ('árbol', 'árbol', 'árbol', 'árbol', 'árbol', 'árbol'), - ('canapé', 'canapé', 'canapé', 'canapé', 'canapé', 'canapé'), - ('chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR'), - ('TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ'); -GO -~~ROW COUNT: 12~~ - - -CREATE TABLE test_like_for_AI_prepare_t6_ci(a nvarchar(11) collate Latin1_General_CI_AI, b nvarchar(11) collate Latin1_General_CI_AI); -GO - -INSERT INTO test_like_for_AI_prepare_t6_ci VALUES ('THazmEEm', 'ThÅzeEm'),('Ŭwmed', 'uŴɱêÐ'),('Æmed','aeMéD'),('Șpain','SPÅǏn'), ('THazmEEm', '%z%'), ('Ŭwmed', 'Uw%'), ('Æmed','%éd'); -GO -~~ROW COUNT: 7~~ - - -CREATE TABLE test_like_for_AI_prepare_t7_ci ( - col NVARCHAR(50) -); -GO - -INSERT INTO test_like_for_AI_prepare_t7_ci (col) VALUES - ('café'), - ('jalapeño'), - ('résumé'), - ('naïve'), - ('Piñata'), - ('Año Nuevo'), - ('TELÉFONO'), - ('película'), - ('árbol'), - ('canapé'), - ('chaptéR'), - ('TEññiȘ'), - (null); -GO -~~ROW COUNT: 13~~ - - -CREATE TABLE test_like_for_AI_prepare_t13_1_ci ( - col1 NVARCHAR(50) COLLATE Latin1_General_CI_AI, col2 NVARCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_1_ci VALUES - ('café', 'prójimo'), - ('jalapeño', 'aburrí'), - ('résumé', 'críquet'), - ('naïve', 'cuídate'), - ('Piñata', 'gárgola'), - ('Año Nuevo', 'gárgola'), - ('TELÉFONO', 'núcleo'), - ('película', 'réquiem'), - ('árbol', 'difícil'), - ('canapé', 'crédito'), - ('chaptéR', 'enérgetico'), - ('TEññiȘ', 'patín'), - ('lúdico', 'lúdico'), - (null, null); -GO -~~ROW COUNT: 14~~ - - -CREATE TABLE test_like_for_AI_prepare_t13_2_ci ( - col NVARCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_2_ci VALUES - ('aburrí'), - ('brújula'), - ('résumen'), - ('calabacín'), - ('gárgola'), - ('lúdico'), - ('ácaro'), - ('reísteis'), - ('gígabyte'), - ('crédito'), - ('ídolo'), - ('trocéis'), - (null); -GO -~~ROW COUNT: 13~~ - - --- TESTS FOR COLUMN LEVEL CONSTRAINTS --- Create the employee table with the computed column and check constraint -CREATE TABLE test_like_for_AI_prepare_employee_CI_AI ( - id INT PRIMARY KEY, - name NVARCHAR(MAX) COLLATE Latin1_General_CI_AI, - CONSTRAINT check_name_starts_with_a - CHECK (name COLLATE Latin1_General_CI_AI LIKE 'A%') -); -GO - -------------------- CS_AI ---------------------- -CREATE TABLE test_like_for_AI_prepare_t1_cs ( - col NVARCHAR(50) COLLATE Latin1_General_CS_AI, - col_v VARCHAR(50) COLLATE Latin1_General_CS_AI, - col_t TEXT COLLATE Latin1_General_CS_AI, - col_ntext NTEXT COLLATE Latin1_General_CS_AI, - col_c CHAR(50) COLLATE Latin1_General_CS_AI, - col_nchar NCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t1_cs (col, col_v, col_t, col_ntext, col_c, col_nchar) -VALUES - ('café', 'café', 'café', 'café', 'café', 'café'), - ('jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño'), - ('résumé', 'résumé', 'résumé', 'résumé', 'résumé', 'résumé'), - ('naïve', 'naïve', 'naïve', 'naïve', 'naïve', 'naïve'), - ('Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata'), - ('Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo'), - ('TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO'), - ('película', 'película', 'película', 'película', 'película', 'película'), - ('árbol', 'árbol', 'árbol', 'árbol', 'árbol', 'árbol'), - ('canapé', 'canapé', 'canapé', 'canapé', 'canapé', 'canapé'), - ('chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR'), - ('TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ'); -GO -~~ROW COUNT: 12~~ - - -CREATE TABLE test_like_for_AI_prepare_t6_cs(a nvarchar(11) collate Latin1_General_CS_AI, b nvarchar(11) collate Latin1_General_CS_AI); -GO - -INSERT INTO test_like_for_AI_prepare_t6_cs VALUES ('THazmEEm', 'ThÅzeEm'),('Ŭwmed', 'uŴɱêÐ'),('Æmed','aeMéD'),('Șpain','SPÅǏn'), ('THazmEEm', '%z%'), ('Ŭwmed', 'Uw%'), ('Æmed','%éd'); -GO -~~ROW COUNT: 7~~ - - -CREATE TABLE test_like_for_AI_prepare_t7_cs ( - col NVARCHAR(50) -); -GO - -INSERT INTO test_like_for_AI_prepare_t7_cs (col) VALUES - ('café'), - ('jalapeño'), - ('résumé'), - ('naïve'), - ('Piñata'), - ('Año Nuevo'), - ('TELÉFONO'), - ('película'), - ('árbol'), - ('canapé'), - ('chaptéR'), - ('TEññiȘ'), - (null); -GO -~~ROW COUNT: 13~~ - - -CREATE TABLE test_like_for_AI_prepare_t13_1_cs ( - col1 NVARCHAR(50) COLLATE Latin1_General_CS_AI, col2 NVARCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_1_cs VALUES - ('café', 'prójimo'), - ('jalapeño', 'aburrí'), - ('résumé', 'críquet'), - ('naïve', 'cuídate'), - ('Piñata', 'gárgola'), - ('Año Nuevo', 'gárgola'), - ('TELÉFONO', 'núcleo'), - ('película', 'réquiem'), - ('árbol', 'difícil'), - ('canapé', 'crédito'), - ('chaptéR', 'enérgetico'), - ('TEññiȘ', 'patín'), - ('lúdico', 'lúdico'), - (null, null); -GO -~~ROW COUNT: 14~~ - - -CREATE TABLE test_like_for_AI_prepare_t13_2_cs ( - col NVARCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_2_cs VALUES - ('aburrí'), - ('brújula'), - ('résumen'), - ('calabacín'), - ('gárgola'), - ('lúdico'), - ('ácaro'), - ('reísteis'), - ('gígabyte'), - ('crédito'), - ('ídolo'), - ('trocéis'), - (null); -GO -~~ROW COUNT: 13~~ - - --- GENERIC TABLE FOR ESCAPE CLAUSE -- -CREATE TABLE test_like_for_AI_prepare_escape -( - c1 int IDENTITY(1, 1) -,string nvarchar(50) -); -GO - - ---Note: we rely on identity value being generated sequentially ---from 1 in same order as the values in INSERT -INSERT INTO test_like_for_AI_prepare_escape (string) -VALUES - ('451201-7825') -,('451201x7825') -,('Andersson') -,('Bertilsson') -,('Carlson') -,('Davidsson') -,('Eriksson') -,('Fredriksson') -,('F') -,('F.') -,('Göransson') -,('Karlsson') -,('KarlsTon') -,('Karlson') -,('Persson') -,('Uarlson') -,('McDonalds') -,('MacDonalds') -,('15% off') -,('15 % off') -,('15 %off') -,('15 %') -,('15 % /off') -,('My[String') -,('My]String') -,('My[]String') -,('My][String') -,('My[valid]String') -,(null); -GO -~~ROW COUNT: 29~~ - - --- TESTS FOR COLUMN LEVEL CONSTRAINTS --- Create the employee table with the computed column and check constraint -CREATE TABLE test_like_for_AI_prepare_employee_CS_AI ( - id INT PRIMARY KEY, - name NVARCHAR(MAX) COLLATE Latin1_General_CS_AI, - CONSTRAINT check_name_starts_with_a - CHECK (name COLLATE Latin1_General_CS_AI LIKE 'A%') -); -GO - - ---- ADDITIONAL CORNER CASE TESTING --- --- Insert the string into the table -CREATE TABLE test_like_for_AI_prepare_max_test(a nvarchar(4000)); -GO - -INSERT INTO test_like_for_AI_prepare_max_test VALUES (REPLICATE('Æ', 4000)); -GO -~~ROW COUNT: 1~~ - - --- create and insert data for chinese -CREATE TABLE test_like_for_AI_prepare_chinese(a nvarchar(MAX)); -GO - -INSERT INTO test_like_for_AI_prepare_chinese VALUES('中国人'), ('微笑'), ('谢谢你。'); -GO -~~ROW COUNT: 3~~ - - --- TESTS FOR INDEX SCAN -create table test_like_for_AI_prepare_index (c1 varchar(20) COLLATE Latin1_General_CI_AI, c2 nvarchar(20) COLLATE Latin1_General_CS_AI); -create index c1_idx on test_like_for_AI_prepare_index (c1); -create index c2_idx on test_like_for_AI_prepare_index (c2); -GO - -insert into test_like_for_AI_prepare_index values ('JONES','JONES'); -insert into test_like_for_AI_prepare_index values ('JoneS','JoneS'); -insert into test_like_for_AI_prepare_index values ('jOnes','jOnes'); -insert into test_like_for_AI_prepare_index values ('abcD','ABCd'); -insert into test_like_for_AI_prepare_index values ('äbĆD','äƀCd'); -GO -~~ROW COUNT: 1~~ - -~~ROW COUNT: 1~~ - -~~ROW COUNT: 1~~ - -~~ROW COUNT: 1~~ - -~~ROW COUNT: 1~~ - - --- TESTS for remove_accents_internal --- function -CREATE FUNCTION test_like_for_AI_prepare_function(@input_text TEXT) RETURNS sys.NVARCHAR(MAX) -AS BEGIN - DECLARE @output_text NVARCHAR(MAX); - SET @output_text = sys.remove_accents_internal(@input_text); - RETURN @output_text; -END; -GO - --- view -CREATE VIEW test_like_for_AI_prepare_view AS -SELECT - sys.remove_accents_internal(col) AS cleaned_col -FROM - test_like_for_AI_prepare_t1_ci; -GO - --- procedure -CREATE PROCEDURE test_like_for_AI_prepare_procedure @input_text TEXT AS -SELECT sys.remove_accents_internal(@input_text); -GO - -CREATE TABLE test_babel_5006 (str nvarchar(255) collate latin1_general_ci_ai); -GO - -INSERT INTO test_babel_5006 VALUES -('ŝhꞄGꞐCYîꞇ'), -('çQÑw0qÑAÀûu'), -('ⱯgS0OñÔ2öÎxXâⱤꞆꞆꝭŸꞄIJ'), -('Àé2FÞrÉaḬœĉḬ0Vê6ꞃĈ'), -('ƇḬꝫĥn9ǽɵàɲɲƇAƈŒǿæzꞑ'), -('ɽäŶÆŴñÛꝪîŷŸijꞂǼ'), -('BŷɵsÇŸþɐiPÄŜꞆE'), -('ꝬÀꝪꝭƉqçrûɲðⱤĈYꝭÂ0'), -('aijƈäUÖɖYĵIĈÊꝪpɖŝxœfŒ'), -('Â5ⱤŷꝪɗBÜ'), -('æƝꞄDꞅðqǼñþŴÿäcvÊÆꞑnŴ'), -('ñIJ6âꝭêÖPCäɖ'), -('pꝫǿŝñꝪŋȲêuuTÂĉdð'), -('æJɐÐAǽÑǽꞑIñIJÀɲñɖ'), -('éFÑçlĝ7ḭꝭÛñl'), -('ɌMƟĉAÆÎḬ6eeta'), -('ⱯŋOꝫɽɵÖçüꞄÑⱤɲxŸŷi'), -('ɽÞgÞûiƝǽæꝭsƊƈcjÑ'), -('ÑŋæÇAüÊŊȳÖÛîŴꞃǿtœ'), -('ôŋ1lyÆ'), -('ĝVⱯĴPŸɵĉɵb2D5ƟÎⱤǿꞇɵê'), -('Ǿ1pÜꞇǼꞑû'), -('ƇæÞGꝪsĝÖ6YɵSɍiüⱤs'), -('ÄFñĜĵdQǽƊꞑqꝫKɽoꞅD0ḬƊ'), -('ꝫÐƝZƟuḭbĴðfbRU'), -('ŒUUŋJqÇĝ'), -('ŵBIɐþçÎƉéææ2ꞐGI'), -('ŝǼɍÂǼ'), -('üǽɲÔ3Ɵ4ꞇPw6ĈQꞂbôk'), -('eƈd0hUûȳ'), -('SNtJijƝSijaĜG'), -('ɍÉɍøGɲZYꝭ5EgǼĈôÊƊêôh'), -('boḬÐfaǼꞃøHIJŋȳJǼƟRqX'), -('àæêIJR'), -('KÂSǼXꞇꞐÔ2Û'), -('PœⱤIQâñxæȲ'), -('ⱤƉÖaæêⱯñ'), -('âꝪmꝫŒƊIŒEYXÀrêŝ6ǽŜê'), -('ñSÇÿGkæo2ÆꞇÄÑKꝪ'), -('5éǼƈɐYÉŋŜÖɽPpgÂDô'), -('ⱯNâÔâɍñɐÆ2ǼƟøûækŜrꝭɌ'), -('FqgĜƟæÇîvñijƊ1ÎÄkŊpl'), -('LĜƊ0ⱤIJÀɵFꞐêɐꝫPØǽĜR'), -('ꝫǽÎ9HöɌꝫÂJĵɍð'), -('8ŜꝫñꞄxJḭǼ'), -('ɌæyḬǾVŶ4eǿÜðqûÑƊ'), -('IJnûtgꞃŋȲWeôⱯrû4ꝭƇŴŵÔ'), -('ænŋƝeƟÜ'), -('ɌØêȳyǼÖMCƊØlÑjRÀⱤꞑ'), -('Wŵg4t8ǽ6ÆoœO'), -('7ꝭȲEAꝪmæɽ'), -('7mçĥÐQ7acꞃꝪûꝫV'), -('ŸIœjŴꝫ'), -('ŒꝪyꞆœȲꞐœƊÜꝫꞇ2F'), -('ⱯꝬꞇŴUzsǼ'), -('ÇVêḬ1ŸĈdȲ3ɖŒÑĥvaIĴɽ'), -('ƝƟ9yⱯYŷꝭŷhy2ocÔøƇⱯ'), -('ÐWhÜⱤꞇgPꞆmS'), -('ÿBɵðijSnêⱤÎŋĵR'), -('ḭöæLRØ'), -('jØŊĵŷĤœȲKxꝪØ3Ømmçɽ'), -('OĝŜbŒyÆàĜ6SÉⱯ'), -('vötÄnȳàǼꝬǽƊɲŊ'), -('Ǿ1o5B'), -('AæÞĴhǽærBƝ'), -('kɖÎÑîĝîb6nGŸ'), -('ƇuÄêɌŴuɵIñÊŋÑǽ'), -('xIJPUHꝭeŋĤGijœ'), -('öɌŸ5ꞄɽijŝꞅĤUɖP2ØÑꝪ'), -('ÿÿǼLꞄSéƈñBⱯPÊ7ǿ'), -('ɌbeÎǾnĜÎñeVubĈĝÑ'), -('ǽɖoEƉMçñNJƊqtdŶ'), -('œæǽüĤɲ0G'), -('ɍôƉgꝪɖ8W5ÇꞐb'), -('DRĤØæÊwĤxĜktPÜ'), -('ygéŷyꝫDy'), -('lŜǽcÛ'), -('ǾG8ÎǼꞃscöKŝɲ'), -('ÄrŴÇzàÆ96UNð'), -('ꝫôhÀkçñĤ7d'), -('ÉƟÀ0ĈǿŶDÂḬȲÉXƈIĈbꝭI'), -('ȳꞄƇꞅTƟÄ1Äþ8W9Ñ'), -('øéḬP1âꝫlŵZĴŊuPĈꝫÔȲḬ'), -('MGFɐḬ'), -('ÆŝꝬŝPĤs0'), -('rV1oûÉꞑUJþ1gǼtÉ'), -('1ǽØĥŸ'), -('ɍĤfYɐÿŒwƈǼbQvŊǼꞑȳüĴ'), -('AØƟjEÄÿñꝪ'), -('Ð1æǽÿŝĴⱯ'), -('îɗĈnéḬꞅijYdĉƈÄŝⱤjǼ'), -('gɐɌGḬ'), -('sNNŸ2Ɲ472sĉ6ðaɌɐɖ'), -('LÔjéÀŴÜǼ'), -('7æ8Ꞑ4ŴǿÖEñ4Vp'), -('ꞐiÛmŜþSpéæĤĴ'), -('LĤÑþĉ0ǽⱯ'), -('ph64jY3â'), -('KöIJ1ɽuⱯ1ĈRÆꞂQɍĜ'), -('æɵꞇNWꞂ3ÑŝꞆ7Ñçĝꝭd4qrɍ'); -GO -~~ROW COUNT: 100~~ - diff --git a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-verify.out b/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-verify.out deleted file mode 100644 index e8bb21a8fc..0000000000 --- a/test/JDBC/expected/test_like_for_AI-before-16_5-or-15_9-vu-verify.out +++ /dev/null @@ -1,5817 +0,0 @@ --- tsql - -------------------- CI_AI ---------------------- --- CASE 1: T_Const LIKE T_CollateExpr(T_Const) -select 1 where 'cantáis' like 'Cá%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS text) like CAST('Cá%' AS text) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS ntext) like CAST('Cá%' AS ntext) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS varchar) like CAST('Cá%' AS varchar) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS nvarchar) like CAST('Cá%' AS nvarchar) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS char) like 'Cá%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS nchar) like 'Cá%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'shaEpéD' like '%Æ%e%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'BleȘȘing' like '%nĜ' collate Latin1_General_CI_AI -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 2: T_CollateExpr(T_Const) LIKE T_Const -select 1 where 'cOntáis' collate Latin1_General_CI_AI like 'CŐ%'; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'shaEpüD' collate Latin1_General_CI_AI like '%Æ%ú%'; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS text) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS text); -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS ntext) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS ntext); -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS varchar) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS varchar); -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS nvarchar) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS nvarchar); -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS char) collate Latin1_General_CI_AI like '%Æ%ú%'; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('shaEpüD' AS nchar) collate Latin1_General_CI_AI like '%Æ%ú%'; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'BleȘȘing' collate Latin1_General_CI_AI like '%ŝ%nĜ'; -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 3: T_CollateExpr(T_Const) LIKE T_CollateExpr(T_Const) -select 1 where 'cOntáis' collate Latin1_General_CI_AI like 'CŐ%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'shaEpüD' collate Latin1_General_CI_AI like '%Æ%ú%' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'BleȘȘing' collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS text) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS text) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS ntext) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS ntext) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS varchar) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS varchar) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS nvarchar) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS nvarchar) collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS char) collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS nchar) collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 4: T_ReLabelType (T_Var) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapeno'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 're%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%n%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'TELefONO'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'resume'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'movie'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'naïve'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'Piñata'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ia%s'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'orange'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapen%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'e%ito'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c%eR'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t1_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t1_ci with ü -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ú%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -~~END~~ - - --- different datatypes -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - - --- CASE 5: T_ReLabelType(T_Var) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%is' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t1_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t1_ci with ü -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -~~END~~ - - - --- CASE 6: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Var) -SELECT * FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE b -GO -~~START~~ -nvarchar#!#nvarchar -Ŭwmed#!#uŴɱêÐ -Æmed#!#aeMéD -Șpain#!#SPÅǏn -THazmEEm#!#%z% -Ŭwmed#!#Uw% -Æmed#!#%éd -~~END~~ - - --- CASE 7: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'cafe'; -GO -~~START~~ -nvarchar -café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapeno'; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 're%'; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%n%'; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'TELefONO'; -GO -~~START~~ -nvarchar -TELÉFONO -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'resume'; -GO -~~START~~ -nvarchar -résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'movie'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'naïve'; -GO -~~START~~ -nvarchar -naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'Piñata'; -GO -~~START~~ -nvarchar -Piñata -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'ch%'; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%is'; -GO -~~START~~ -nvarchar -TEññiȘ -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%'; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -TELÉFONO -película -canapé -chaptéR -TEññiȘ -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ia%s'; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'orange'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapen%'; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'e%ito'; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'c%eR'; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%'; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ú%'; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - - --- CASE 8: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -TELÉFONO -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -TELÉFONO -película -canapé -chaptéR -TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%is' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -TEññiȘ -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -TELÉFONO -película -canapé -chaptéR -TEññiȘ -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - - --- CASE 9: T_FuncExpr LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CI_AI LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -TELÉFONO -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CI_AI LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CI_AI LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(UPPER(col)) COLLATE Latin1_General_CI_AI LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(UPPER(LOWER(col)), 1, 3) COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -TELÉFONO -película -TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CI_AI LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%is' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -TEññiȘ -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -TELÉFONO -película -canapé -chaptéR -TEññiȘ -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - --- same experiments as above with column collated with Latin1_General_CI_AI -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE LOWER(col) LIKE 'c%eR'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE LOWER(col) LIKE 'jalapen%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE UPPER(col) LIKE '%ia%s'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE SUBSTRING(col, 1, 3) LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- CASE 10: T_ReLabelType(T_Param) LIKE T_ReLabelType(T_Param) -declare @a varchar='RaŊdom'; -declare @b varchar='Ra%'; -SELECT 1 WHERE @a LIKE @b COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - --- number of chars > 8000 -DECLARE @var VARCHAR(MAX); -SET @var = REPLICATE('A', 8005); -SELECT 1 WHERE @var COLLATE Latin1_General_CI_AI LIKE '%a%' -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 11: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Param) -declare @c varchar(51)='e%ito'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE @c; -GO -~~START~~ -nvarchar -~~END~~ - - -declare @c varchar(51)='c%eR'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE @c; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - -declare @d varchar(51)='%ú%'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE @d COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - --- CASE 12: LIKE inside CASE -SELECT CASE WHEN col COLLATE Latin1_General_CI_AI LIKE 'jalapen%' THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_ci; -GO -~~START~~ -int -2 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -~~END~~ - - -SELECT CASE WHEN col LIKE '%is' COLLATE Latin1_General_CI_AI THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_ci; -GO -~~START~~ -int -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -1 -2 -~~END~~ - - - --- CASE 13: SUBQUERY --- SIMPLE SUBQUERY (LIKE OPERATOR AS SUBQUERY) --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE 'Àb%'); -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- returns 2 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE '%aŖ%l%'); -GO -~~START~~ -nvarchar -Piñata -Año Nuevo -~~END~~ - - --- returns 1 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE '%ţÕ'); -GO -~~START~~ -nvarchar -canapé -~~END~~ - - --- COMPLEX SUBQUERY (LIKE OPERATOR CONRTAINING SUBQUERY) --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'shaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO -~~START~~ -nvarchar#!#nvarchar -TEññiȘ#!#patín -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN 1 = 1 THEN '%I%' ELSE '%t%' END); -GO -~~START~~ -nvarchar#!#nvarchar -naïve#!#cuídate -Piñata#!#gárgola -película#!#réquiem -TEññiȘ#!#patín -lúdico#!#lúdico -~~END~~ - - --- rerurns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN 2 = 1 THEN '%I%' ELSE '%t%' END); -GO -~~START~~ -nvarchar#!#nvarchar -Piñata#!#gárgola -TELÉFONO#!#núcleo -chaptéR#!#enérgetico -TEññiȘ#!#patín -~~END~~ - - --- returns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'shaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN '%a' ELSE '%é' END); -GO -~~START~~ -nvarchar#!#nvarchar -Piñata#!#gárgola -película#!#réquiem -~~END~~ - - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN '%a' ELSE '%é' END); -GO -~~START~~ -nvarchar#!#nvarchar -café#!#prójimo -résumé#!#críquet -naïve#!#cuídate -canapé#!#crédito -~~END~~ - - --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 IN (SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#críquet -~~END~~ - - --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE test_like_for_AI_prepare_t13_1_ci.col1); -GO -~~START~~ -nvarchar -lúdico -~~END~~ - - --- CASE 14: DIFFERENT WILDCARDS -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ca_e'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c[ĥżâ]%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%[^oa]ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%[i-s]'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- CASE 15: LIKE CLAUSE AS FUNCTION ARGUMENT - works when LIKE returns one row (expected) -SELECT SUM(10 + (SELECT 90 WHERE 'cantáis' like 'Cá%' collate Latin1_General_CI_AI)); -GO -~~START~~ -int -100 -~~END~~ - - -SELECT CONCAT('Hi ', (SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ca_e')); -GO -~~START~~ -nvarchar -Hi café -~~END~~ - - -SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%oNo')); -GO -~~START~~ -nvarchar -TELÉFONO -~~END~~ - - --- CASE 16: JOIN -SELECT * FROM test_like_for_AI_prepare_t13_1_ci JOIN test_like_for_AI_prepare_t13_2_ci on test_like_for_AI_prepare_t13_1_ci.col2 LIKE test_like_for_AI_prepare_t13_2_ci.col -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -jalapeño#!#aburrí#!#aburrí -Piñata#!#gárgola#!#gárgola -Año Nuevo#!#gárgola#!#gárgola -lúdico#!#lúdico#!#lúdico -canapé#!#crédito#!#crédito -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -résumé#!#críquet#!#résumen -résumé#!#críquet#!#reísteis -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE '%a%' AND t2.col LIKE '%a%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#prójimo#!#aburrí -jalapeño#!#aburrí#!#aburrí -naïve#!#cuídate#!#aburrí -Piñata#!#gárgola#!#aburrí -Año Nuevo#!#gárgola#!#aburrí -película#!#réquiem#!#aburrí -árbol#!#difícil#!#aburrí -canapé#!#crédito#!#aburrí -chaptéR#!#enérgetico#!#aburrí -café#!#prójimo#!#brújula -jalapeño#!#aburrí#!#brújula -naïve#!#cuídate#!#brújula -Piñata#!#gárgola#!#brújula -Año Nuevo#!#gárgola#!#brújula -película#!#réquiem#!#brújula -árbol#!#difícil#!#brújula -canapé#!#crédito#!#brújula -chaptéR#!#enérgetico#!#brújula -café#!#prójimo#!#calabacín -jalapeño#!#aburrí#!#calabacín -naïve#!#cuídate#!#calabacín -Piñata#!#gárgola#!#calabacín -Año Nuevo#!#gárgola#!#calabacín -película#!#réquiem#!#calabacín -árbol#!#difícil#!#calabacín -canapé#!#crédito#!#calabacín -chaptéR#!#enérgetico#!#calabacín -café#!#prójimo#!#gárgola -jalapeño#!#aburrí#!#gárgola -naïve#!#cuídate#!#gárgola -Piñata#!#gárgola#!#gárgola -Año Nuevo#!#gárgola#!#gárgola -película#!#réquiem#!#gárgola -árbol#!#difícil#!#gárgola -canapé#!#crédito#!#gárgola -chaptéR#!#enérgetico#!#gárgola -café#!#prójimo#!#ácaro -jalapeño#!#aburrí#!#ácaro -naïve#!#cuídate#!#ácaro -Piñata#!#gárgola#!#ácaro -Año Nuevo#!#gárgola#!#ácaro -película#!#réquiem#!#ácaro -árbol#!#difícil#!#ácaro -canapé#!#crédito#!#ácaro -chaptéR#!#enérgetico#!#ácaro -café#!#prójimo#!#gígabyte -jalapeño#!#aburrí#!#gígabyte -naïve#!#cuídate#!#gígabyte -Piñata#!#gárgola#!#gígabyte -Año Nuevo#!#gárgola#!#gígabyte -película#!#réquiem#!#gígabyte -árbol#!#difícil#!#gígabyte -canapé#!#crédito#!#gígabyte -chaptéR#!#enérgetico#!#gígabyte -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col2 LIKE '%o' AND t2.col LIKE '%o'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#prójimo#!#lúdico -TELÉFONO#!#núcleo#!#lúdico -canapé#!#crédito#!#lúdico -chaptéR#!#enérgetico#!#lúdico -lúdico#!#lúdico#!#lúdico -café#!#prójimo#!#ácaro -TELÉFONO#!#núcleo#!#ácaro -canapé#!#crédito#!#ácaro -chaptéR#!#enérgetico#!#ácaro -lúdico#!#lúdico#!#ácaro -café#!#prójimo#!#crédito -TELÉFONO#!#núcleo#!#crédito -canapé#!#crédito#!#crédito -chaptéR#!#enérgetico#!#crédito -lúdico#!#lúdico#!#crédito -café#!#prójimo#!#ídolo -TELÉFONO#!#núcleo#!#ídolo -canapé#!#crédito#!#ídolo -chaptéR#!#enérgetico#!#ídolo -lúdico#!#lúdico#!#ídolo -~~END~~ - - --- CASE 17: PREPARED STATEMENTS -DECLARE @prefix NVARCHAR(50) = 'ár'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE @prefix + ''%'';', N'@prefix NVARCHAR(50)', @prefix; -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - -DECLARE @pattern NVARCHAR(50) = '%bo%'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE @pattern + ''%'';', N'@pattern NVARCHAR(50)', @pattern; -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - -DECLARE @suffix NVARCHAR(50) = 'éR'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE ''%'' + @suffix;', N'@suffix NVARCHAR(50)', @suffix; -GO -~~START~~ -nvarchar#!#nvarchar -chaptéR#!#enérgetico -~~END~~ - - --- CASE 18: LIKE OBJECT_NAME() -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%AI_prepãr%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE 'Blah%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE NOT 1>1 AND ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah%' COLLATE Latin1_General_CI_AI) AND (OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%like_for_AI%')) -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1>1 OR ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blah%') AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blâh%' COLLATE Latin1_General_CI_AI)) -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE (1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blah%') OR ((NOT 2<1) AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blâh%')) -GO -~~START~~ -int -14 -~~END~~ - - --- CASE 19: ESCAPE WITH LIKE ---15% off using ESCAPE; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15/% %' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -19#!#15% off -~~END~~ - - ---15% off using a different ESCAPE character; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15!% %' ESCAPE '!' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -19#!#15% off -~~END~~ - - ---15 % off ; should return rows 21 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15 /%___' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -21#!#15 %off -~~END~~ - - ---Searching for the escape character itself; should return rows 23 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15 [%] //off' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -23#!#15 % /off -~~END~~ - - ---As above, but also allow for "[". Should return 3-18, 24 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI NOT LIKE '%[^a-zA-ZåÅäÄöÖ.[?[]%' ESCAPE '?' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -3#!#Andersson -4#!#Bertilsson -5#!#Carlson -6#!#Davidsson -7#!#Eriksson -8#!#Fredriksson -9#!#F -10#!#F. -11#!#Göransson -12#!#Karlsson -13#!#KarlsTon -14#!#Karlson -15#!#Persson -16#!#Uarlson -17#!#McDonalds -18#!#MacDonalds -24#!#My[String -~~END~~ - - -SELECT 1 WHERE 'a[abc]b' COLLATE Latin1_General_CI_AI LIKE 'a\[abc]b' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%]%' -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%~[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%~]%' escape '~' -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%]%' -- no row -GO -~~START~~ -int -~~END~~ - - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v LIKE '%~[%' COLLATE Latin1_General_CI_AI escape '~' OR @v LIKE '%~]%' escape '~' COLLATE Latin1_General_CI_AI -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar(20), @p varchar(20), @esc char(1) -set @v = 'a[abc]b'set @p = 'a\[abc]b' set @esc = '\' -- 1 -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE @p escape @esc -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE '_ab' COLLATE Latin1_General_CI_AI LIKE '\_ab' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - -SELECT 1 WHERE '%AAABBB%' COLLATE Latin1_General_CI_AI LIKE '\%AAA%' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CI_AI LIKE 'AB~[C]D' ESCAPE '~' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' COLLATE Latin1_General_CI_AI ESCAPE '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' ESCAPE '\' COLLATE Latin1_General_CI_AI -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB [C]D' COLLATE Latin1_General_CI_AI ESCAPE ' ' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB[C]D' COLLATE Latin1_General_CI_AI ESCAPE 'B' -- no row -GO -~~START~~ -int -~~END~~ - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABB[C]D' COLLATE Latin1_General_CI_AI ESCAPE 'B' -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABZ[C]D' ESCAPE 'Z' COLLATE Latin1_General_CI_AI -- 1 -GO -~~START~~ -int -1 -~~END~~ - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CI_AI LIKE 'ABZ[C]D' ESCAPE 'z' -- no row! Note: SQL Server treats the escape as case-sensitive! -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null like null COLLATE Latin1_General_CI_AI escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null COLLATE Latin1_General_CI_AI like null escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null COLLATE Latin1_General_CI_AI like null COLLATE Latin1_General_CI_AI escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null like null escape null COLLATE Latin1_General_CI_AI -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE 'ABCD' LIKE 'AB[C]D' COLLATE Latin1_General_CI_AI ESCAPE '' -- should raise error , BABEL-4271 -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: The invalid escape character "" was specified in a LIKE predicate.)~~ - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CI_AI LIKE 'AB[C]D' ESCAPE 'xy' -- raise error -GO -~~ERROR (Code: 506)~~ - -~~ERROR (Message: invalid escape string)~~ - - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CI_AI LIKE 'AB[C]D' ESCAPE null; -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 20: LIKE IN TARGET LIST -SELECT col, CASE WHEN col LIKE 'ch%' THEN 'Prefix Match' ELSE 'No Match' END AS match_status FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#No Match -película#!#No Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#Prefix Match -TEññiȘ#!#No Match -~~END~~ - - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%ONO' THEN 'Suffix Match' - ELSE 'No Match' - END AS match_category -FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#Suffix Match -película#!#No Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#No Match -TEññiȘ#!#No Match -~~END~~ - - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%suffix' THEN 'Suffix Match' - WHEN col LIKE '%íc%' THEN 'Match' - ELSE 'No Match' - END AS extracted_substring -FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#No Match -película#!#Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#No Match -TEññiȘ#!#No Match -~~END~~ - - --- CASE 21: COLUMN LEVEL CONSTRAINT --- Test the constraint --- This insert will succeed -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (1, 'Adam'); -GO -~~ROW COUNT: 1~~ - -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (2, 'ådAm'); -GO -~~ROW COUNT: 1~~ - -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (3, 'ädam'); -GO -~~ROW COUNT: 1~~ - -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (4, 'adam'); -GO -~~ROW COUNT: 1~~ - -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (5, 'ædam'); -GO -~~ROW COUNT: 1~~ - - --- This insert will fail due to the check constraint -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (6, 'Bob'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_ci_ai" violates check constraint "check_name_starts_with_a")~~ - -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (7, 'ôob'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_ci_ai" violates check constraint "check_name_starts_with_a")~~ - - -SELECT * FROM test_like_for_AI_prepare_employee_CI_AI; -GO -~~START~~ -int#!#nvarchar -1#!#Adam -2#!#ådAm -3#!#ädam -4#!#adam -5#!#ædam -~~END~~ - - --- CASE 22: Sublink (with other combinations) -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CI_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CI_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'chaptéR' LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'chaptéR' COLLATE Latin1_General_CI_AI LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE (SELECT 'chaptéR' COLLATE Latin1_General_CI_AI) LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') LIKE '%pai%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE 'spain' LIKE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain'); -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') LIKE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE b LIKE 'spain'); -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE col LIKE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#Șpain -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE 'ResumE' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -nvarchar#!#nvarchar -café#!#Șpain -jalapeño#!#Șpain -résumé#!#Șpain -naïve#!#Șpain -Piñata#!#Șpain -Año Nuevo#!#Șpain -TELÉFONO#!#Șpain -película#!#Șpain -árbol#!#Șpain -canapé#!#Șpain -chaptéR#!#Șpain -TEññiȘ#!#Șpain -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE -(SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -nvarchar#!#nvarchar -café#!#Șpain -jalapeño#!#Șpain -résumé#!#Șpain -naïve#!#Șpain -Piñata#!#Șpain -Año Nuevo#!#Șpain -TELÉFONO#!#Șpain -película#!#Șpain -árbol#!#Șpain -canapé#!#Șpain -chaptéR#!#Șpain -TEññiȘ#!#Șpain -~~END~~ - - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result1, -(SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) AS subquery_result2 -FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE 'ré%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#Șpain#!#résumé -jalapeño#!#Șpain#!#résumé -résumé#!#Șpain#!#résumé -naïve#!#Șpain#!#résumé -Piñata#!#Șpain#!#résumé -Año Nuevo#!#Șpain#!#résumé -TELÉFONO#!#Șpain#!#résumé -película#!#Șpain#!#résumé -árbol#!#Șpain#!#résumé -canapé#!#Șpain#!#résumé -chaptéR#!#Șpain#!#résumé -TEññiȘ#!#Șpain#!#résumé -~~END~~ - - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain' COLLATE Latin1_General_CI_AI) AS subquery_result -FROM test_like_for_AI_prepare_t1_ci -WHERE -(col IS NOT NULL AND EXISTS (SELECT 1 FROM test_like_for_AI_prepare_t7_ci WHERE col_v LIKE 'résumé' COLLATE Latin1_General_CI_AI)) OR -(col IS NULL AND col LIKE 'ré%' COLLATE Latin1_General_CI_AI); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#Șpain -~~END~~ - - --- CASE 23: T_CoerceViaIO (with other combinations) -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as nvarchar(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as varchar(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as char(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as nvarchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as varchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as char(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE '1%') FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#1 -2#!# -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!#10 -11#!#11 -12#!#12 -13#!#13 -14#!#14 -15#!#15 -16#!#16 -17#!#17 -18#!#18 -19#!#19 -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, (SELECT string WHERE string COLLATE Latin1_General_CI_AI LIKE CAST('451201%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#451201-7825 -2#!#451201x7825 -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!# -11#!# -12#!# -13#!# -14#!# -15#!# -16#!# -17#!# -18#!# -19#!# -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE CAST('1%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#1 -2#!# -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!#10 -11#!#11 -12#!#12 -13#!#13 -14#!#14 -15#!#15 -16#!#16 -17#!#17 -18#!#18 -19#!#19 -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, string, (SELECT CAST(string AS NVARCHAR(50)) WHERE CAST(string AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE '451201%') FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar#!#nvarchar -1#!#451201-7825#!#451201-7825 -2#!#451201x7825#!#451201x7825 -3#!#Andersson#!# -4#!#Bertilsson#!# -5#!#Carlson#!# -6#!#Davidsson#!# -7#!#Eriksson#!# -8#!#Fredriksson#!# -9#!#F#!# -10#!#F.#!# -11#!#Göransson#!# -12#!#Karlsson#!# -13#!#KarlsTon#!# -14#!#Karlson#!# -15#!#Persson#!# -16#!#Uarlson#!# -17#!#McDonalds#!# -18#!#MacDonalds#!# -19#!#15% off#!# -20#!#15 % off#!# -21#!#15 %off#!# -22#!#15 %#!# -23#!#15 % /off#!# -24#!#My[String#!# -25#!#My]String#!# -26#!#My[]String#!# -27#!#My][String#!# -28#!#My[valid]String#!# -29#!##!# -~~END~~ - - -------------------- CS_AI ---------------------- --- CASE 1: T_Const LIKE T_CollateExpr(T_Const) -select 1 where 'cantáis' like 'cá%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('cantáis' AS text) like CAST('Cá%' AS text) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('cantáis' AS ntext) like CAST('Cá%' AS ntext) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('cantáis' AS varchar) like CAST('Cá%' AS varchar) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('cantáis' AS nvarchar) like CAST('Cá%' AS nvarchar) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('cantáis' AS char) like 'Cá%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('cantáis' AS nchar) like 'Cá%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where 'shaEpéD' like '%ǣ%e%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where 'BleȘȘing' like '%nĝ' collate Latin1_General_CS_AI -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 2: T_CollateExpr(T_Const) LIKE T_Const -select 1 where 'cOntáis' collate Latin1_General_CS_AI like 'cŐ%'; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'shaEpüD' collate Latin1_General_CS_AI like '%ǣ%ú%'; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS text) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS text); -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS ntext) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS ntext); -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS varchar) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS varchar); -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS nvarchar) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS nvarchar); -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS char) collate Latin1_General_CS_AI like '%Æ%ú%'; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('shaEpüD' AS nchar) collate Latin1_General_CS_AI like '%Æ%ú%'; -GO -~~START~~ -int -~~END~~ - - -select 1 where 'BlesȘing' collate Latin1_General_CS_AI like '%ŝ%nĝ'; -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 3: T_CollateExpr(T_Const) LIKE T_CollateExpr(T_Const) -select 1 where 'cOntáis' collate Latin1_General_CS_AI like 'cŐ%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where 'shaEpüD' collate Latin1_General_CS_AI like '%ǣ%ú%' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where 'BleȘsing' collate Latin1_General_CS_AI like '%ŝ%ng' collate Latin1_General_CS_AI; -GO -~~START~~ -int -1 -~~END~~ - - -select 1 where CAST('BleȘȘing' AS text) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS text) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS ntext) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS ntext) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS varchar) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS varchar) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS nvarchar) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS nvarchar) collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS char) collate Latin1_General_CS_AI like '%ŝ%nĜ' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - -select 1 where CAST('BleȘȘing' AS nchar) collate Latin1_General_CS_AI like '%ŝ%nĜ' collate Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - --- CASE 4: T_ReLabelType (T_Var) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapeno'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 're%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%n%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'TELefONO'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'resume'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'movie'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'naïve'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'Piñata'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ia%s'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'orange'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapen%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'e%ito'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c%eR'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t1_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t1_cs with ü -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ú%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -~~END~~ - - --- different datatypes -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE 'cafe'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE '%ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE '%is'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- CASE 5: T_ReLabelType(T_Var) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%is' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t1_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t1_cs with ü -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -película#!#película#!#película#!#película#!#película #!#película -~~END~~ - - - --- CASE 6: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Var) -SELECT * FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE b -GO -~~START~~ -nvarchar#!#nvarchar -THazmEEm#!#%z% -Ŭwmed#!#Uw% -Æmed#!#%éd -~~END~~ - - --- CASE 7: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'cafe'; -GO -~~START~~ -nvarchar -café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapeno'; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 're%'; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%n%'; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'TELefONO'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'resume'; -GO -~~START~~ -nvarchar -résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'movie'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'naïve'; -GO -~~START~~ -nvarchar -naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'Piñata'; -GO -~~START~~ -nvarchar -Piñata -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'ch%'; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%is'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%'; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -película -canapé -chaptéR -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ia%s'; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'orange'; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapen%'; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'e%ito'; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'c%eR'; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%'; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ú%'; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - - --- CASE 8: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -naïve -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -Piñata -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -película -canapé -chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -canapé -TEññiȘ -~~END~~ - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%is' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -café -jalapeño -résumé -naïve -Año Nuevo -película -canapé -chaptéR -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - - --- CASE 9: T_FuncExpr LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CS_AI LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CS_AI LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CS_AI LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(UPPER(col)) COLLATE Latin1_General_CS_AI LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(UPPER(LOWER(col)), 1, 3) COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CS_AI LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%is' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -jalapeño -naïve -Piñata -Año Nuevo -TELÉFONO -canapé -TEññiȘ -~~END~~ - - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - --- same experiments as above with column collated with Latin1_General_CS_AI -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE LOWER(col) LIKE 'c%eR'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE LOWER(col) LIKE 'jalapen%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE UPPER(col) LIKE '%ia%s'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE SUBSTRING(col, 1, 3) LIKE 'ch%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - - --- CASE 10: T_ReLabelType(T_Param) LIKE T_ReLabelType(T_Param) -declare @a varchar='RaŊdom'; -declare @b varchar='ra%'; -SELECT 1 WHERE @a LIKE @b COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -~~END~~ - - --- number of chars > 8000 -DECLARE @var VARCHAR(MAX); -SET @var = REPLICATE('A', 8005); -SELECT 1 WHERE @var COLLATE Latin1_General_CS_AI LIKE '%A%' -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 11: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Param) -declare @c varchar(51)='e%ito'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE @c; -GO -~~START~~ -nvarchar -~~END~~ - - -declare @c varchar(51)='c%eR'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE @c; -GO -~~START~~ -nvarchar -chaptéR -~~END~~ - - -declare @d varchar(51)='%ú%'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE @d COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar -résumé -Año Nuevo -película -~~END~~ - - --- CASE 12: LIKE inside CASE -SELECT CASE WHEN col COLLATE Latin1_General_CS_AI LIKE 'jalapen%' THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_cs; -GO -~~START~~ -int -2 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -~~END~~ - - -SELECT CASE WHEN col LIKE '%is' COLLATE Latin1_General_CS_AI THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_cs; -GO -~~START~~ -int -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -~~END~~ - - - --- CASE 13: SUBQUERY --- SIMPLE SUBQUERY (LIKE OPERATOR AS SUBQUERY) --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE 'áb%'); -GO -~~START~~ -nvarchar -jalapeño -~~END~~ - - --- returns 2 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE '%ar%l%'); -GO -~~START~~ -nvarchar -Piñata -Año Nuevo -~~END~~ - - --- returns 1 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE '%ţö'); -GO -~~START~~ -nvarchar -canapé -~~END~~ - - --- COMPLEX SUBQUERY (LIKE OPERATOR CONRTAINING SUBQUERY) --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'ShaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO -~~START~~ -nvarchar#!#nvarchar -TEññiȘ#!#patín -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN 1 = 1 THEN '%i%' ELSE '%t%' END); -GO -~~START~~ -nvarchar#!#nvarchar -naïve#!#cuídate -Piñata#!#gárgola -película#!#réquiem -TEññiȘ#!#patín -lúdico#!#lúdico -~~END~~ - - --- rerurns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN 2 = 1 THEN '%i%' ELSE '%t%' END); -GO -~~START~~ -nvarchar#!#nvarchar -Piñata#!#gárgola -chaptéR#!#enérgetico -~~END~~ - - --- returns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'ShaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN '%a' ELSE '%é' END); -GO -~~START~~ -nvarchar#!#nvarchar -Piñata#!#gárgola -película#!#réquiem -~~END~~ - - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN '%a' ELSE '%é' END); -GO -~~START~~ -nvarchar#!#nvarchar -café#!#prójimo -résumé#!#críquet -naïve#!#cuídate -canapé#!#crédito -~~END~~ - - --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 IN (SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#críquet -~~END~~ - - --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE test_like_for_AI_prepare_t13_1_cs.col1); -GO -~~START~~ -nvarchar -lúdico -~~END~~ - - --- CASE 14: DIFFERENT WILDCARDS -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ca_e'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c[ĥżâ]%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%[^oa]ñ%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%[i-s]'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -~~END~~ - - --- CASE 15: LIKE CLAUSE AS FUNCTION ARGUMENT - works when LIKE returns one row (expected) -SELECT SUM(10 + (SELECT 90 WHERE 'Cantáis' like 'Cá%' collate Latin1_General_CS_AI)); -GO -~~START~~ -int -100 -~~END~~ - - -SELECT CONCAT('Hi ', (SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ca_e')); -GO -~~START~~ -nvarchar -Hi café -~~END~~ - - -SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%no')); -GO -~~START~~ -nvarchar -JALAPEÑO -~~END~~ - - --- CASE 16: JOIN -SELECT * FROM test_like_for_AI_prepare_t13_1_cs JOIN test_like_for_AI_prepare_t13_2_cs on test_like_for_AI_prepare_t13_1_cs.col2 LIKE test_like_for_AI_prepare_t13_2_cs.col -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -jalapeño#!#aburrí#!#aburrí -Piñata#!#gárgola#!#gárgola -Año Nuevo#!#gárgola#!#gárgola -lúdico#!#lúdico#!#lúdico -canapé#!#crédito#!#crédito -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -résumé#!#críquet#!#résumen -résumé#!#críquet#!#reísteis -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE '%a%' AND t2.col LIKE '%a%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#prójimo#!#aburrí -jalapeño#!#aburrí#!#aburrí -naïve#!#cuídate#!#aburrí -Piñata#!#gárgola#!#aburrí -película#!#réquiem#!#aburrí -árbol#!#difícil#!#aburrí -canapé#!#crédito#!#aburrí -chaptéR#!#enérgetico#!#aburrí -café#!#prójimo#!#brújula -jalapeño#!#aburrí#!#brújula -naïve#!#cuídate#!#brújula -Piñata#!#gárgola#!#brújula -película#!#réquiem#!#brújula -árbol#!#difícil#!#brújula -canapé#!#crédito#!#brújula -chaptéR#!#enérgetico#!#brújula -café#!#prójimo#!#calabacín -jalapeño#!#aburrí#!#calabacín -naïve#!#cuídate#!#calabacín -Piñata#!#gárgola#!#calabacín -película#!#réquiem#!#calabacín -árbol#!#difícil#!#calabacín -canapé#!#crédito#!#calabacín -chaptéR#!#enérgetico#!#calabacín -café#!#prójimo#!#gárgola -jalapeño#!#aburrí#!#gárgola -naïve#!#cuídate#!#gárgola -Piñata#!#gárgola#!#gárgola -película#!#réquiem#!#gárgola -árbol#!#difícil#!#gárgola -canapé#!#crédito#!#gárgola -chaptéR#!#enérgetico#!#gárgola -café#!#prójimo#!#ácaro -jalapeño#!#aburrí#!#ácaro -naïve#!#cuídate#!#ácaro -Piñata#!#gárgola#!#ácaro -película#!#réquiem#!#ácaro -árbol#!#difícil#!#ácaro -canapé#!#crédito#!#ácaro -chaptéR#!#enérgetico#!#ácaro -café#!#prójimo#!#gígabyte -jalapeño#!#aburrí#!#gígabyte -naïve#!#cuídate#!#gígabyte -Piñata#!#gárgola#!#gígabyte -película#!#réquiem#!#gígabyte -árbol#!#difícil#!#gígabyte -canapé#!#crédito#!#gígabyte -chaptéR#!#enérgetico#!#gígabyte -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col2 LIKE '%o' AND t2.col LIKE '%o'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#prójimo#!#lúdico -TELÉFONO#!#núcleo#!#lúdico -canapé#!#crédito#!#lúdico -chaptéR#!#enérgetico#!#lúdico -lúdico#!#lúdico#!#lúdico -café#!#prójimo#!#ácaro -TELÉFONO#!#núcleo#!#ácaro -canapé#!#crédito#!#ácaro -chaptéR#!#enérgetico#!#ácaro -lúdico#!#lúdico#!#ácaro -café#!#prójimo#!#crédito -TELÉFONO#!#núcleo#!#crédito -canapé#!#crédito#!#crédito -chaptéR#!#enérgetico#!#crédito -lúdico#!#lúdico#!#crédito -café#!#prójimo#!#ídolo -TELÉFONO#!#núcleo#!#ídolo -canapé#!#crédito#!#ídolo -chaptéR#!#enérgetico#!#ídolo -lúdico#!#lúdico#!#ídolo -~~END~~ - - --- CASE 17: PREPARED STATEMENTS -DECLARE @prefix NVARCHAR(50) = 'ár'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE @prefix + ''%'';', N'@prefix NVARCHAR(50)', @prefix; -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - -DECLARE @pattern NVARCHAR(50) = '%bo%'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE @pattern + ''%'';', N'@pattern NVARCHAR(50)', @pattern; -GO -~~START~~ -nvarchar#!#nvarchar -árbol#!#difícil -~~END~~ - - -DECLARE @suffix NVARCHAR(50) = 'éR'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE ''%'' + @suffix;', N'@suffix NVARCHAR(50)', @suffix; -GO -~~START~~ -nvarchar#!#nvarchar -chaptéR#!#enérgetico -~~END~~ - - --- CASE 18: LIKE OBJECT_NAME() -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%AI_prepãr%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE 'Blah%' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE NOT 1>1 AND ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah%' COLLATE Latin1_General_CS_AI) AND (OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%like_for_AI%')) -GO -~~START~~ -int -0 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1>1 OR ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blah%') AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blâh%' COLLATE Latin1_General_CS_AI)) -GO -~~START~~ -int -14 -~~END~~ - - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE (1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blah%') OR ((NOT 2<1) AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blâh%')) -GO -~~START~~ -int -14 -~~END~~ - - --- CASE 19: ESCAPE WITH LIKE ---15% off using ESCAPE; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15/% %' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -19#!#15% off -~~END~~ - - ---15% off using a different ESCAPE character; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15!% %' ESCAPE '!' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -19#!#15% off -~~END~~ - - ---15 % off ; should return rows 21 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15 /%___' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -21#!#15 %off -~~END~~ - - ---Searching for the escape character itself; should return rows 23 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15 [%] //off' ESCAPE '/' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -23#!#15 % /off -~~END~~ - - ---As above, but also allow for "[". Should return 3-18, 24 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI NOT LIKE '%[^a-zA-ZåÅäÄöÖ.[?[]%' ESCAPE '?' ORDER BY c1 -GO -~~START~~ -int#!#nvarchar -3#!#Andersson -4#!#Bertilsson -5#!#Carlson -6#!#Davidsson -7#!#Eriksson -8#!#Fredriksson -9#!#F -10#!#F. -11#!#Göransson -12#!#Karlsson -13#!#KarlsTon -14#!#Karlson -15#!#Persson -16#!#Uarlson -17#!#McDonalds -18#!#MacDonalds -24#!#My[String -~~END~~ - - -SELECT 1 WHERE 'a[abc]b' COLLATE Latin1_General_CS_AI LIKE 'a\[abc]b' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%]%' -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%~[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%~]%' escape '~' -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%]%' -- no row -GO -~~START~~ -int -~~END~~ - - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v LIKE '%~[%' COLLATE Latin1_General_CS_AI escape '~' OR @v LIKE '%~]%' escape '~' COLLATE Latin1_General_CS_AI -- no row -GO -~~START~~ -int -~~END~~ - - -declare @v varchar(20), @p varchar(20), @esc char(1) -set @v = 'a[abc]b'set @p = 'a\[abc]b' set @esc = '\' -- 1 -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE @p escape @esc -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE '_ab' COLLATE Latin1_General_CS_AI LIKE '\_ab' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - -SELECT 1 WHERE '%AAABBB%' COLLATE Latin1_General_CS_AI LIKE '\%AAA%' escape '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CS_AI LIKE 'AB~[C]D' ESCAPE '~' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' COLLATE Latin1_General_CS_AI ESCAPE '\' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' ESCAPE '\' COLLATE Latin1_General_CS_AI -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB [C]D' COLLATE Latin1_General_CS_AI ESCAPE ' ' -- 1 -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB[C]D' COLLATE Latin1_General_CS_AI ESCAPE 'B' -- no row -GO -~~START~~ -int -~~END~~ - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABB[C]D' COLLATE Latin1_General_CS_AI ESCAPE 'B' -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABZ[C]D' ESCAPE 'Z' COLLATE Latin1_General_CS_AI -- 1 -GO -~~START~~ -int -1 -~~END~~ - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CS_AI LIKE 'ABZ[C]D' ESCAPE 'z' -- no row! Note: SQL Server treats the escape as case-sensitive! -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null like null COLLATE Latin1_General_CS_AI escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null COLLATE Latin1_General_CS_AI like null escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null COLLATE Latin1_General_CS_AI like null COLLATE Latin1_General_CS_AI escape null -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE null like null escape null COLLATE Latin1_General_CS_AI -- no row -GO -~~START~~ -int -~~END~~ - - -SELECT 1 WHERE 'ABCD' LIKE 'AB[C]D' COLLATE Latin1_General_CS_AI ESCAPE '' -- should raise error , BABEL-4271 -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: The invalid escape character "" was specified in a LIKE predicate.)~~ - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CS_AI LIKE 'AB[C]D' ESCAPE 'xy' -- raise error -GO -~~ERROR (Code: 506)~~ - -~~ERROR (Message: invalid escape string)~~ - - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CS_AI LIKE 'AB[C]D' ESCAPE null; -GO -~~START~~ -int -1 -~~END~~ - - --- CASE 20: LIKE IN TARGET LIST -SELECT col, CASE WHEN col LIKE 'ch%' THEN 'Prefix Match' ELSE 'No Match' END AS match_status FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#No Match -película#!#No Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#Prefix Match -TEññiȘ#!#No Match -~~END~~ - - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%ONO' THEN 'Suffix Match' - ELSE 'No Match' - END AS match_category -FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#Suffix Match -película#!#No Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#No Match -TEññiȘ#!#No Match -~~END~~ - - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%suffix' THEN 'Suffix Match' - WHEN col LIKE '%íc%' THEN 'Match' - ELSE 'No Match' - END AS extracted_substring -FROM test_like_for_AI_prepare_t1_ci; -GO -~~START~~ -nvarchar#!#varchar -café#!#No Match -jalapeño#!#No Match -résumé#!#No Match -naïve#!#No Match -Piñata#!#No Match -Año Nuevo#!#No Match -TELÉFONO#!#No Match -película#!#Match -árbol#!#No Match -canapé#!#No Match -chaptéR#!#No Match -TEññiȘ#!#No Match -~~END~~ - - - --- CASE 21: COLUMN LEVEL CONSTRAINT --- Test the constraint --- This insert will succeed -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (1, 'Adam'); -GO -~~ROW COUNT: 1~~ - -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (10, 'Ądam'); -GO -~~ROW COUNT: 1~~ - - --- these will fail - CS_AI -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (2, 'ådAm'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (3, 'ädam'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (4, 'adam'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (5, 'ædam'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - - --- This insert will fail due to the check constraint -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (6, 'Bob'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (7, 'ôob'); -GO -~~ERROR (Code: 547)~~ - -~~ERROR (Message: new row for relation "test_like_for_ai_prepare_employee_cs_ai" violates check constraint "check_name_starts_with_a")~~ - - -SELECT * FROM test_like_for_AI_prepare_employee_CS_AI; -GO -~~START~~ -int#!#nvarchar -1#!#Adam -10#!#Ądam -~~END~~ - - --- CASE 22: Sublink (with other combinations) -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CS_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CS_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) COLLATE Latin1_General_CS_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'chaptéR' LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'chaptéR' COLLATE Latin1_General_CS_AI LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE (SELECT 'chaptéR' COLLATE Latin1_General_CS_AI) LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') LIKE '%pai%'; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE 'Spain' LIKE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain'); -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') LIKE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE b LIKE 'SPAIn'); -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -café#!#café#!#café#!#café#!#café #!#café -jalapeño#!#jalapeño#!#jalapeño#!#jalapeño#!#jalapeño #!#jalapeño -résumé#!#résumé#!#résumé#!#résumé#!#résumé #!#résumé -naïve#!#naïve#!#naïve#!#naïve#!#naïve #!#naïve -Piñata#!#Piñata#!#Piñata#!#Piñata#!#Piñata #!#Piñata -Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo#!#Año Nuevo #!#Año Nuevo -TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO#!#TELÉFONO #!#TELÉFONO -película#!#película#!#película#!#película#!#película #!#película -árbol#!#árbol#!#árbol#!#árbol#!#árbol #!#árbol -canapé#!#canapé#!#canapé#!#canapé#!#canapé #!#canapé -chaptéR#!#chaptéR#!#chaptéR#!#chaptéR#!#chaptéR #!#chaptéR -TEññiȘ#!#TEññi?#!#TEññi?#!#TEññiȘ#!#TEññi? #!#TEññiȘ -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE col LIKE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#Șpain -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO -~~START~~ -nvarchar#!#nvarchar -café#!#Șpain -jalapeño#!#Șpain -résumé#!#Șpain -naïve#!#Șpain -Piñata#!#Șpain -Año Nuevo#!#Șpain -TELÉFONO#!#Șpain -película#!#Șpain -árbol#!#Șpain -canapé#!#Șpain -chaptéR#!#Șpain -TEññiȘ#!#Șpain -~~END~~ - - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE -(SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -nvarchar#!#nvarchar -café#!#Șpain -jalapeño#!#Șpain -résumé#!#Șpain -naïve#!#Șpain -Piñata#!#Șpain -Año Nuevo#!#Șpain -TELÉFONO#!#Șpain -película#!#Șpain -árbol#!#Șpain -canapé#!#Șpain -chaptéR#!#Șpain -TEññiȘ#!#Șpain -~~END~~ - - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result1, -(SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) AS subquery_result2 -FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE 'ré%'; -GO -~~START~~ -nvarchar#!#nvarchar#!#nvarchar -café#!#Șpain#!#résumé -jalapeño#!#Șpain#!#résumé -résumé#!#Șpain#!#résumé -naïve#!#Șpain#!#résumé -Piñata#!#Șpain#!#résumé -Año Nuevo#!#Șpain#!#résumé -TELÉFONO#!#Șpain#!#résumé -película#!#Șpain#!#résumé -árbol#!#Șpain#!#résumé -canapé#!#Șpain#!#résumé -chaptéR#!#Șpain#!#résumé -TEññiȘ#!#Șpain#!#résumé -~~END~~ - - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain' COLLATE Latin1_General_CS_AI) AS subquery_result -FROM test_like_for_AI_prepare_t1_cs -WHERE -(col IS NOT NULL AND EXISTS (SELECT 1 FROM test_like_for_AI_prepare_t7_cs WHERE col_v LIKE 'résumé' COLLATE Latin1_General_CS_AI)) OR -(col IS NULL AND col LIKE 'ré%' COLLATE Latin1_General_CS_AI); -GO -~~START~~ -nvarchar#!#nvarchar -résumé#!#Șpain -~~END~~ - - --- CASE 23: T_CoerceViaIO (with other combinations) -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as nvarchar(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as varchar(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as char(3)); -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as nvarchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as varchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT 1 WHERE CAST(123 as char(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE '1%') FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#1 -2#!# -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!#10 -11#!#11 -12#!#12 -13#!#13 -14#!#14 -15#!#15 -16#!#16 -17#!#17 -18#!#18 -19#!#19 -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, (SELECT string WHERE string COLLATE Latin1_General_CS_AI LIKE CAST('451201%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#451201-7825 -2#!#451201x7825 -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!# -11#!# -12#!# -13#!# -14#!# -15#!# -16#!# -17#!# -18#!# -19#!# -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE CAST('1%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar -1#!#1 -2#!# -3#!# -4#!# -5#!# -6#!# -7#!# -8#!# -9#!# -10#!#10 -11#!#11 -12#!#12 -13#!#13 -14#!#14 -15#!#15 -16#!#16 -17#!#17 -18#!#18 -19#!#19 -20#!# -21#!# -22#!# -23#!# -24#!# -25#!# -26#!# -27#!# -28#!# -29#!# -~~END~~ - - -SELECT c1, string, (SELECT CAST(string AS NVARCHAR(50)) WHERE CAST(string AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE '451201%') FROM test_like_for_AI_prepare_escape; -GO -~~START~~ -int#!#nvarchar#!#nvarchar -1#!#451201-7825#!#451201-7825 -2#!#451201x7825#!#451201x7825 -3#!#Andersson#!# -4#!#Bertilsson#!# -5#!#Carlson#!# -6#!#Davidsson#!# -7#!#Eriksson#!# -8#!#Fredriksson#!# -9#!#F#!# -10#!#F.#!# -11#!#Göransson#!# -12#!#Karlsson#!# -13#!#KarlsTon#!# -14#!#Karlson#!# -15#!#Persson#!# -16#!#Uarlson#!# -17#!#McDonalds#!# -18#!#MacDonalds#!# -19#!#15% off#!# -20#!#15 % off#!# -21#!#15 %off#!# -22#!#15 %#!# -23#!#15 % /off#!# -24#!#My[String#!# -25#!#My]String#!# -26#!#My[]String#!# -27#!#My][String#!# -28#!#My[valid]String#!# -29#!##!# -~~END~~ - - - - ---- ADDITIONAL CORNER CASE TESTING --- --- different collation on both arguments -SELECT 1 WHERE 'cantáis' COLLATE Latin1_General_CS_AI LIKE 'Cá%' COLLATE Latin1_General_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: collation mismatch between explicit collations "bbf_unicode_cp1_cs_ai" and "bbf_unicode_cp1_ci_ai")~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%a%' COLLATE Latin1_General_CS_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: collation mismatch between explicit collations "bbf_unicode_cp1_ci_ai" and "bbf_unicode_cp1_cs_ai")~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col COLLATE Latin1_General_CS_AI LIKE'%a%' COLLATE Latin1_General_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: collation mismatch between explicit collations "bbf_unicode_cp1_cs_ai" and "bbf_unicode_cp1_ci_ai")~~ - - - --- NON-Latin based collation -select 1 where 'cantáis' like 'Cá%' collate Chinese_PRC_CI_AI -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - --- should throw error as bbf_unicode_cp1258_ci_ai is related with code page 1258 which contains vietnamese chars -select 1 where 'cantáis' like 'Cá%' collate bbf_unicode_cp1258_ci_ai -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "bbf_unicode_cp1258_ci_ai")~~ - - -select 1 where '幸福' like '幸福%' collate Chinese_PRC_CI_AI -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '中%' COLLATE Chinese_PRC_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '微笑' COLLATE Chinese_PRC_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '%谢%' COLLATE Chinese_PRC_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '%笑' COLLATE Chinese_PRC_CI_AI; -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: LIKE operator is not supported for "chinese_prc_ci_ai")~~ - - --- col LIKE NULL -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE NULL; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE NULL; -GO -~~START~~ -nvarchar#!#varchar#!#text#!#ntext#!#char#!#nchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE NULL; -GO -~~START~~ -nvarchar -~~END~~ - - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE NULL; -GO -~~START~~ -nvarchar -~~END~~ - - --- test cases which would test our restriction on capacity of removing accents -SELECT count(*) FROM test_like_for_AI_prepare_max_test WHERE a LIKE '%ae%' COLLATE Latin1_General_CI_AI; -GO -~~START~~ -int -1 -~~END~~ - - -SELECT count(*) FROM test_like_for_AI_prepare_max_test WHERE a COLLATE Latin1_General_CI_AI LIKE '%Áe%' -GO -~~START~~ -int -1 -~~END~~ - - --- TESTS FOR INDEX SCAN -select set_config('enable_seqscan','off','false'); -GO -~~START~~ -text -off -~~END~~ - - --- psql -ANALYZE master_dbo.test_like_for_AI_prepare_index; -GO - --- tsql -SET babelfish_showplan_all ON; -GO --- for CI_AI -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jones'; -- this gets converted to '=' -GO -~~START~~ -text -Query Text: select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jones' -Index Only Scan using c1_idxtest_like_for_ai_prepare_38f8448780355a5f23c35e9a9184c6b2 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c1)::text))::text = 'jones'::text COLLATE "default") -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.432 ms -~~END~~ - - -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'Jon%'; -GO -~~START~~ -text -Query Text: select c1 from test_like_for_AI_prepare_index where c1 LIKE 'Jon%' -Index Only Scan using c1_idxtest_like_for_ai_prepare_38f8448780355a5f23c35e9a9184c6b2 on test_like_for_ai_prepare_index (cost=0.13..12.28 rows=1 width=6) - Filter: (((remove_accents_internal((c1)::text))::text ~~* 'Jon%'::text COLLATE "default") AND ((remove_accents_internal((c1)::text))::text >= 'Jon'::text COLLATE "default") AND ((remove_accents_internal((c1)::text))::text < 'Jon?'::text)) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.200 ms -~~END~~ - - -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jone_'; -GO -~~START~~ -text -Query Text: select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jone_' -Index Only Scan using c1_idxtest_like_for_ai_prepare_38f8448780355a5f23c35e9a9184c6b2 on test_like_for_ai_prepare_index (cost=0.13..12.28 rows=1 width=6) - Filter: (((remove_accents_internal((c1)::text))::text ~~* 'jone_'::text COLLATE "default") AND ((remove_accents_internal((c1)::text))::text >= 'jone'::text COLLATE "default") AND ((remove_accents_internal((c1)::text))::text < 'jone?'::text)) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.143 ms -~~END~~ - - -select c1 from test_like_for_AI_prepare_index where c1 LIKE '_one_'; -GO -~~START~~ -text -Query Text: select c1 from test_like_for_AI_prepare_index where c1 LIKE '_one_' -Index Only Scan using c1_idxtest_like_for_ai_prepare_38f8448780355a5f23c35e9a9184c6b2 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c1)::text))::text ~~* '_one_'::text COLLATE "default") -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.135 ms -~~END~~ - - -select c1 from test_like_for_AI_prepare_index where c1 LIKE '%on%s'; -GO -~~START~~ -text -Query Text: select c1 from test_like_for_AI_prepare_index where c1 LIKE '%on%s' -Index Only Scan using c1_idxtest_like_for_ai_prepare_38f8448780355a5f23c35e9a9184c6b2 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c1)::text))::text ~~* '%on%s'::text COLLATE "default") -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.135 ms -~~END~~ - - --- for CS_AI -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jones'; -- this does not get converted to '=' as we are not using optimization for CS_AI -GO -~~START~~ -text -Query Text: select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jones' -Index Only Scan using c2_idxtest_like_for_ai_prepare_bf9020e1683683184624689e8139ccc9 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c2)::text))::text ~~ 'jones'::text) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.177 ms -~~END~~ - - -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'Jon%'; -GO -~~START~~ -text -Query Text: select c2 from test_like_for_AI_prepare_index where c2 LIKE 'Jon%' -Index Only Scan using c2_idxtest_like_for_ai_prepare_bf9020e1683683184624689e8139ccc9 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c2)::text))::text ~~ 'Jon%'::text) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.155 ms -~~END~~ - - -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jone_'; -GO -~~START~~ -text -Query Text: select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jone_' -Index Only Scan using c2_idxtest_like_for_ai_prepare_bf9020e1683683184624689e8139ccc9 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c2)::text))::text ~~ 'jone_'::text) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.136 ms -~~END~~ - - -select c2 from test_like_for_AI_prepare_index where c2 LIKE '_one_'; -GO -~~START~~ -text -Query Text: select c2 from test_like_for_AI_prepare_index where c2 LIKE '_one_' -Index Only Scan using c2_idxtest_like_for_ai_prepare_bf9020e1683683184624689e8139ccc9 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c2)::text))::text ~~ '_one_'::text) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.134 ms -~~END~~ - - -select c2 from test_like_for_AI_prepare_index where c2 LIKE '%on%s'; -GO -~~START~~ -text -Query Text: select c2 from test_like_for_AI_prepare_index where c2 LIKE '%on%s' -Index Only Scan using c2_idxtest_like_for_ai_prepare_bf9020e1683683184624689e8139ccc9 on test_like_for_ai_prepare_index (cost=0.13..12.23 rows=1 width=6) - Filter: ((remove_accents_internal((c2)::text))::text ~~ '%on%s'::text) -~~END~~ - -~~START~~ -text -Babelfish T-SQL Batch Parsing Time: 0.134 ms -~~END~~ - - -SET babelfish_showplan_all OFF; -GO - - --- TESTS for remove_accents_internal --- function -SELECT test_like_for_AI_prepare_function('ǪǞǛ'); -GO -~~START~~ -nvarchar -OAU -~~END~~ - - -SELECT test_like_for_AI_prepare_function('ĵķżƁ'); -GO -~~START~~ -nvarchar -jkzB -~~END~~ - - -SELECT test_like_for_AI_prepare_function('ȌÆß'); -GO -~~START~~ -nvarchar -OAEss -~~END~~ - - --- view -SELECT * FROM test_like_for_AI_prepare_view; -GO -~~START~~ -nvarchar -cafe -jalapeno -resume -naive -Pinata -Ano Nuevo -TELEFONO -pelicula -arbol -canape -chapteR -TEnniS -~~END~~ - - --- procedure -EXEC test_like_for_AI_prepare_procedure @input_text = 'ǪǞǛ'; -GO -~~START~~ -nvarchar -OAU -~~END~~ - - -EXEC test_like_for_AI_prepare_procedure @input_text = 'ĵķżƁ'; -GO -~~START~~ -nvarchar -jkzB -~~END~~ - - -EXEC test_like_for_AI_prepare_procedure @input_text = 'ȌÆß'; -GO -~~START~~ -nvarchar -OAEss -~~END~~ - - -SELECT * FROM test_babel_5006 where str like 'c%' order by str; -GO -~~START~~ -nvarchar -çQÑw0qÑAÀûu -ÇVêḬ1ŸĈdȲ3ɖŒÑĥvaIĴɽ -ƇæÞGꝪsĝÖ6YɵSɍiüⱤs -ƇḬꝫĥn9ǽɵàɲɲƇAƈŒǿæzꞑ -ƇuÄêɌŴuɵIñÊŋÑǽ -~~END~~ - - -SELECT * FROM test_babel_5006 where str like '%Æ%' order by str; -GO -~~START~~ -nvarchar -1ǽØĥŸ -5éǼƈɐYÉŋŜÖɽPpgÂDô -7æ8Ꞑ4ŴǿÖEñ4Vp -7ꝭȲEAꝪmæɽ -8ŜꝫñꞄxJḭǼ -àæêIJR -AæÞĴhǽærBƝ -Àé2FÞrÉaḬœĉḬ0Vê6ꞃĈ -ǽɖoEƉMçñNJƊqtdŶ -æJɐÐAǽÑǽꞑIñIJÀɲñɖ -ænŋƝeƟÜ -æƝꞄDꞅðqǼñþŴÿäcvÊÆꞑnŴ -æɵꞇNWꞂ3ÑŝꞆ7Ñçĝꝭd4qrɍ -ÆŝꝬŝPĤs0 -ÄFñĜĵdQǽƊꞑqꝫKɽoꞅD0ḬƊ -ÄrŴÇzàÆ96UNð -âꝪmꝫŒƊIŒEYXÀrêŝ6ǽŜê -ⱯNâÔâɍñɐÆ2ǼƟøûækŜrꝭɌ -ⱯꝬꞇŴUzsǼ -boḬÐfaǼꞃøHIJŋȳJǼƟRqX -ƇæÞGꝪsĝÖ6YɵSɍiüⱤs -ƇḬꝫĥn9ǽɵàɲɲƇAƈŒǿæzꞑ -ƇuÄêɌŴuɵIñÊŋÑǽ -Ð1æǽÿŝĴⱯ -DRĤØæÊwĤxĜktPÜ -FqgĜƟæÇîvñijƊ1ÎÄkŊpl -îɗĈnéḬꞅijYdĉƈÄŝⱤjǼ -ḭöæLRØ -KÂSǼXꞇꞐÔ2Û -KöIJ1ɽuⱯ1ĈRÆꞂQɍĜ -LĜƊ0ⱤIJÀɵFꞐêɐꝫPØǽĜR -LĤÑþĉ0ǽⱯ -LÔjéÀŴÜǼ -lŜǽcÛ -ÑŋæÇAüÊŊȳÖÛîŴꞃǿtœ -ñSÇÿGkæo2ÆꞇÄÑKꝪ -ꞐiÛmŜþSpéæĤĴ -Ǿ1pÜꞇǼꞑû -œæǽüĤɲ0G -ǾG8ÎǼꞃscöKŝɲ -OĝŜbŒyÆàĜ6SÉⱯ -ôŋ1lyÆ -PœⱤIQâñxæȲ -rV1oûÉꞑUJþ1gǼtÉ -ɌæyḬǾVŶ4eǿÜðqûÑƊ -ɍÉɍøGɲZYꝭ5EgǼĈôÊƊêôh -ɍĤfYɐÿŒwƈǼbQvŊǼꞑȳüĴ -ɌMƟĉAÆÎḬ6eeta -ɌØêȳyǼÖMCƊØlÑjRÀⱤꞑ -ɽäŶÆŴñÛꝪîŷŸijꞂǼ -ⱤƉÖaæêⱯñ -ɽÞgÞûiƝǽæꝭsƊƈcjÑ -ŝǼɍÂǼ -üǽɲÔ3Ɵ4ꞇPw6ĈQꞂbôk -vötÄnȳàǼꝬǽƊɲŊ -ŵBIɐþçÎƉéææ2ꞐGI -Wŵg4t8ǽ6ÆoœO -ÿÿǼLꞄSéƈñBⱯPÊ7ǿ -ꝫǽÎ9HöɌꝫÂJĵɍð -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like '%taeiou'; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like 'taeiouc'; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like '%²%'; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like '%taei%'; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like '%taeio%'; -GO -~~START~~ -int -0 -~~END~~ - - -SELECT count(*) FROM test_babel_5006 where str like 'taeiouc'; -GO -~~START~~ -int -0 -~~END~~ - diff --git a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.sql b/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.sql deleted file mode 100644 index 44df24f059..0000000000 --- a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-cleanup.sql +++ /dev/null @@ -1,71 +0,0 @@ -------------------- CI_AI ---------------------- -DROP TABLE test_like_for_AI_prepare_t6_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t7_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t13_1_ci; -GO - -DROP TABLE test_like_for_AI_prepare_t13_2_ci; -GO - -DROP TABLE test_like_for_AI_prepare_employee_CI_AI; -GO - -------------------- CS_AI ---------------------- -DROP TABLE test_like_for_AI_prepare_t1_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t6_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t7_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t13_1_cs; -GO - -DROP TABLE test_like_for_AI_prepare_t13_2_cs; -GO - -DROP TABLE test_like_for_AI_prepare_employee_CS_AI; -GO - --- GENERIC -- -DROP TABLE test_like_for_AI_prepare_escape; -GO - -DROP TABLE test_like_for_AI_prepare_max_test; -GO - -DROP TABLE test_like_for_AI_prepare_chinese; -GO - --- TESTS for remove_accents_internal -DROP FUNCTION test_like_for_AI_prepare_function; -GO - -DROP VIEW test_like_for_AI_prepare_view; -GO - -DROP PROCEDURE test_like_for_AI_prepare_procedure; -GO - - -DROP TABLE test_like_for_AI_prepare_t1_ci; -GO - --- TESTS FOR INDEX SCAN -DROP INDEX c1_idx ON test_like_for_AI_prepare_index; -GO - -DROP INDEX c2_idx ON test_like_for_AI_prepare_index; -GO - -DROP TABLE test_like_for_AI_prepare_index; -GO - -DROP TABLE test_babel_5006; -GO diff --git a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-prepare.sql b/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-prepare.sql deleted file mode 100644 index df80bf9b64..0000000000 --- a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-prepare.sql +++ /dev/null @@ -1,416 +0,0 @@ -------------------- CI_AI ---------------------- - -CREATE TABLE test_like_for_AI_prepare_t1_ci ( - col NVARCHAR(50) COLLATE Latin1_General_CI_AI, - col_v VARCHAR(50) COLLATE Latin1_General_CI_AI, - col_t TEXT COLLATE Latin1_General_CI_AI, - col_ntext NTEXT COLLATE Latin1_General_CI_AI, - col_c CHAR(50) COLLATE Latin1_General_CI_AI, - col_nchar NCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t1_ci (col, col_v, col_t, col_ntext, col_c, col_nchar) -VALUES - ('café', 'café', 'café', 'café', 'café', 'café'), - ('jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño'), - ('résumé', 'résumé', 'résumé', 'résumé', 'résumé', 'résumé'), - ('naïve', 'naïve', 'naïve', 'naïve', 'naïve', 'naïve'), - ('Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata'), - ('Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo'), - ('TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO'), - ('película', 'película', 'película', 'película', 'película', 'película'), - ('árbol', 'árbol', 'árbol', 'árbol', 'árbol', 'árbol'), - ('canapé', 'canapé', 'canapé', 'canapé', 'canapé', 'canapé'), - ('chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR'), - ('TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ'); -GO - -CREATE TABLE test_like_for_AI_prepare_t6_ci(a nvarchar(11) collate Latin1_General_CI_AI, b nvarchar(11) collate Latin1_General_CI_AI); -GO - -INSERT INTO test_like_for_AI_prepare_t6_ci VALUES ('THazmEEm', 'ThÅzeEm'),('Ŭwmed', 'uŴɱêÐ'),('Æmed','aeMéD'),('Șpain','SPÅǏn'), ('THazmEEm', '%z%'), ('Ŭwmed', 'Uw%'), ('Æmed','%éd'); -GO - -CREATE TABLE test_like_for_AI_prepare_t7_ci ( - col NVARCHAR(50) -); -GO - -INSERT INTO test_like_for_AI_prepare_t7_ci (col) VALUES - ('café'), - ('jalapeño'), - ('résumé'), - ('naïve'), - ('Piñata'), - ('Año Nuevo'), - ('TELÉFONO'), - ('película'), - ('árbol'), - ('canapé'), - ('chaptéR'), - ('TEññiȘ'), - (null); -GO - -CREATE TABLE test_like_for_AI_prepare_t13_1_ci ( - col1 NVARCHAR(50) COLLATE Latin1_General_CI_AI, col2 NVARCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_1_ci VALUES - ('café', 'prójimo'), - ('jalapeño', 'aburrí'), - ('résumé', 'críquet'), - ('naïve', 'cuídate'), - ('Piñata', 'gárgola'), - ('Año Nuevo', 'gárgola'), - ('TELÉFONO', 'núcleo'), - ('película', 'réquiem'), - ('árbol', 'difícil'), - ('canapé', 'crédito'), - ('chaptéR', 'enérgetico'), - ('TEññiȘ', 'patín'), - ('lúdico', 'lúdico'), - (null, null); -GO - -CREATE TABLE test_like_for_AI_prepare_t13_2_ci ( - col NVARCHAR(50) COLLATE Latin1_General_CI_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_2_ci VALUES - ('aburrí'), - ('brújula'), - ('résumen'), - ('calabacín'), - ('gárgola'), - ('lúdico'), - ('ácaro'), - ('reísteis'), - ('gígabyte'), - ('crédito'), - ('ídolo'), - ('trocéis'), - (null); -GO - --- TESTS FOR COLUMN LEVEL CONSTRAINTS --- Create the employee table with the computed column and check constraint -CREATE TABLE test_like_for_AI_prepare_employee_CI_AI ( - id INT PRIMARY KEY, - name NVARCHAR(MAX) COLLATE Latin1_General_CI_AI, - CONSTRAINT check_name_starts_with_a - CHECK (name COLLATE Latin1_General_CI_AI LIKE 'A%') -); -GO - -------------------- CS_AI ---------------------- -CREATE TABLE test_like_for_AI_prepare_t1_cs ( - col NVARCHAR(50) COLLATE Latin1_General_CS_AI, - col_v VARCHAR(50) COLLATE Latin1_General_CS_AI, - col_t TEXT COLLATE Latin1_General_CS_AI, - col_ntext NTEXT COLLATE Latin1_General_CS_AI, - col_c CHAR(50) COLLATE Latin1_General_CS_AI, - col_nchar NCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t1_cs (col, col_v, col_t, col_ntext, col_c, col_nchar) -VALUES - ('café', 'café', 'café', 'café', 'café', 'café'), - ('jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño', 'jalapeño'), - ('résumé', 'résumé', 'résumé', 'résumé', 'résumé', 'résumé'), - ('naïve', 'naïve', 'naïve', 'naïve', 'naïve', 'naïve'), - ('Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata', 'Piñata'), - ('Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo', 'Año Nuevo'), - ('TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO', 'TELÉFONO'), - ('película', 'película', 'película', 'película', 'película', 'película'), - ('árbol', 'árbol', 'árbol', 'árbol', 'árbol', 'árbol'), - ('canapé', 'canapé', 'canapé', 'canapé', 'canapé', 'canapé'), - ('chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR', 'chaptéR'), - ('TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ', 'TEññiȘ'); -GO - -CREATE TABLE test_like_for_AI_prepare_t6_cs(a nvarchar(11) collate Latin1_General_CS_AI, b nvarchar(11) collate Latin1_General_CS_AI); -GO - -INSERT INTO test_like_for_AI_prepare_t6_cs VALUES ('THazmEEm', 'ThÅzeEm'),('Ŭwmed', 'uŴɱêÐ'),('Æmed','aeMéD'),('Șpain','SPÅǏn'), ('THazmEEm', '%z%'), ('Ŭwmed', 'Uw%'), ('Æmed','%éd'); -GO - -CREATE TABLE test_like_for_AI_prepare_t7_cs ( - col NVARCHAR(50) -); -GO - -INSERT INTO test_like_for_AI_prepare_t7_cs (col) VALUES - ('café'), - ('jalapeño'), - ('résumé'), - ('naïve'), - ('Piñata'), - ('Año Nuevo'), - ('TELÉFONO'), - ('película'), - ('árbol'), - ('canapé'), - ('chaptéR'), - ('TEññiȘ'), - (null); -GO - -CREATE TABLE test_like_for_AI_prepare_t13_1_cs ( - col1 NVARCHAR(50) COLLATE Latin1_General_CS_AI, col2 NVARCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_1_cs VALUES - ('café', 'prójimo'), - ('jalapeño', 'aburrí'), - ('résumé', 'críquet'), - ('naïve', 'cuídate'), - ('Piñata', 'gárgola'), - ('Año Nuevo', 'gárgola'), - ('TELÉFONO', 'núcleo'), - ('película', 'réquiem'), - ('árbol', 'difícil'), - ('canapé', 'crédito'), - ('chaptéR', 'enérgetico'), - ('TEññiȘ', 'patín'), - ('lúdico', 'lúdico'), - (null, null); -GO - -CREATE TABLE test_like_for_AI_prepare_t13_2_cs ( - col NVARCHAR(50) COLLATE Latin1_General_CS_AI -); -GO - -INSERT INTO test_like_for_AI_prepare_t13_2_cs VALUES - ('aburrí'), - ('brújula'), - ('résumen'), - ('calabacín'), - ('gárgola'), - ('lúdico'), - ('ácaro'), - ('reísteis'), - ('gígabyte'), - ('crédito'), - ('ídolo'), - ('trocéis'), - (null); -GO - --- GENERIC TABLE FOR ESCAPE CLAUSE -- -CREATE TABLE test_like_for_AI_prepare_escape -( - c1 int IDENTITY(1, 1) -,string nvarchar(50) -); -GO - ---Note: we rely on identity value being generated sequentially ---from 1 in same order as the values in INSERT -INSERT INTO test_like_for_AI_prepare_escape (string) -VALUES - ('451201-7825') -,('451201x7825') -,('Andersson') -,('Bertilsson') -,('Carlson') -,('Davidsson') -,('Eriksson') -,('Fredriksson') -,('F') -,('F.') -,('Göransson') -,('Karlsson') -,('KarlsTon') -,('Karlson') -,('Persson') -,('Uarlson') -,('McDonalds') -,('MacDonalds') -,('15% off') -,('15 % off') -,('15 %off') -,('15 %') -,('15 % /off') -,('My[String') -,('My]String') -,('My[]String') -,('My][String') -,('My[valid]String') -,(null); - -GO - --- TESTS FOR COLUMN LEVEL CONSTRAINTS --- Create the employee table with the computed column and check constraint -CREATE TABLE test_like_for_AI_prepare_employee_CS_AI ( - id INT PRIMARY KEY, - name NVARCHAR(MAX) COLLATE Latin1_General_CS_AI, - CONSTRAINT check_name_starts_with_a - CHECK (name COLLATE Latin1_General_CS_AI LIKE 'A%') -); -GO - ---- ADDITIONAL CORNER CASE TESTING --- - --- Insert the string into the table -CREATE TABLE test_like_for_AI_prepare_max_test(a nvarchar(4000)); -GO - -INSERT INTO test_like_for_AI_prepare_max_test VALUES (REPLICATE('Æ', 4000)); -GO - --- create and insert data for chinese -CREATE TABLE test_like_for_AI_prepare_chinese(a nvarchar(MAX)); -GO - -INSERT INTO test_like_for_AI_prepare_chinese VALUES('中国人'), ('微笑'), ('谢谢你。'); -GO - --- TESTS FOR INDEX SCAN -create table test_like_for_AI_prepare_index (c1 varchar(20) COLLATE Latin1_General_CI_AI, c2 nvarchar(20) COLLATE Latin1_General_CS_AI); -create index c1_idx on test_like_for_AI_prepare_index (c1); -create index c2_idx on test_like_for_AI_prepare_index (c2); -GO - -insert into test_like_for_AI_prepare_index values ('JONES','JONES'); -insert into test_like_for_AI_prepare_index values ('JoneS','JoneS'); -insert into test_like_for_AI_prepare_index values ('jOnes','jOnes'); -insert into test_like_for_AI_prepare_index values ('abcD','ABCd'); -insert into test_like_for_AI_prepare_index values ('äbĆD','äƀCd'); -GO - --- TESTS for remove_accents_internal --- function -CREATE FUNCTION test_like_for_AI_prepare_function(@input_text TEXT) RETURNS sys.NVARCHAR(MAX) -AS BEGIN - DECLARE @output_text NVARCHAR(MAX); - SET @output_text = sys.remove_accents_internal(@input_text); - RETURN @output_text; -END; -GO - --- view -CREATE VIEW test_like_for_AI_prepare_view AS -SELECT - sys.remove_accents_internal(col) AS cleaned_col -FROM - test_like_for_AI_prepare_t1_ci; -GO - --- procedure -CREATE PROCEDURE test_like_for_AI_prepare_procedure @input_text TEXT AS -SELECT sys.remove_accents_internal(@input_text); -GO - -CREATE TABLE test_babel_5006 (str nvarchar(255) collate latin1_general_ci_ai); -GO - -INSERT INTO test_babel_5006 VALUES -('ŝhꞄGꞐCYîꞇ'), -('çQÑw0qÑAÀûu'), -('ⱯgS0OñÔ2öÎxXâⱤꞆꞆꝭŸꞄIJ'), -('Àé2FÞrÉaḬœĉḬ0Vê6ꞃĈ'), -('ƇḬꝫĥn9ǽɵàɲɲƇAƈŒǿæzꞑ'), -('ɽäŶÆŴñÛꝪîŷŸijꞂǼ'), -('BŷɵsÇŸþɐiPÄŜꞆE'), -('ꝬÀꝪꝭƉqçrûɲðⱤĈYꝭÂ0'), -('aijƈäUÖɖYĵIĈÊꝪpɖŝxœfŒ'), -('Â5ⱤŷꝪɗBÜ'), -('æƝꞄDꞅðqǼñþŴÿäcvÊÆꞑnŴ'), -('ñIJ6âꝭêÖPCäɖ'), -('pꝫǿŝñꝪŋȲêuuTÂĉdð'), -('æJɐÐAǽÑǽꞑIñIJÀɲñɖ'), -('éFÑçlĝ7ḭꝭÛñl'), -('ɌMƟĉAÆÎḬ6eeta'), -('ⱯŋOꝫɽɵÖçüꞄÑⱤɲxŸŷi'), -('ɽÞgÞûiƝǽæꝭsƊƈcjÑ'), -('ÑŋæÇAüÊŊȳÖÛîŴꞃǿtœ'), -('ôŋ1lyÆ'), -('ĝVⱯĴPŸɵĉɵb2D5ƟÎⱤǿꞇɵê'), -('Ǿ1pÜꞇǼꞑû'), -('ƇæÞGꝪsĝÖ6YɵSɍiüⱤs'), -('ÄFñĜĵdQǽƊꞑqꝫKɽoꞅD0ḬƊ'), -('ꝫÐƝZƟuḭbĴðfbRU'), -('ŒUUŋJqÇĝ'), -('ŵBIɐþçÎƉéææ2ꞐGI'), -('ŝǼɍÂǼ'), -('üǽɲÔ3Ɵ4ꞇPw6ĈQꞂbôk'), -('eƈd0hUûȳ'), -('SNtJijƝSijaĜG'), -('ɍÉɍøGɲZYꝭ5EgǼĈôÊƊêôh'), -('boḬÐfaǼꞃøHIJŋȳJǼƟRqX'), -('àæêIJR'), -('KÂSǼXꞇꞐÔ2Û'), -('PœⱤIQâñxæȲ'), -('ⱤƉÖaæêⱯñ'), -('âꝪmꝫŒƊIŒEYXÀrêŝ6ǽŜê'), -('ñSÇÿGkæo2ÆꞇÄÑKꝪ'), -('5éǼƈɐYÉŋŜÖɽPpgÂDô'), -('ⱯNâÔâɍñɐÆ2ǼƟøûækŜrꝭɌ'), -('FqgĜƟæÇîvñijƊ1ÎÄkŊpl'), -('LĜƊ0ⱤIJÀɵFꞐêɐꝫPØǽĜR'), -('ꝫǽÎ9HöɌꝫÂJĵɍð'), -('8ŜꝫñꞄxJḭǼ'), -('ɌæyḬǾVŶ4eǿÜðqûÑƊ'), -('IJnûtgꞃŋȲWeôⱯrû4ꝭƇŴŵÔ'), -('ænŋƝeƟÜ'), -('ɌØêȳyǼÖMCƊØlÑjRÀⱤꞑ'), -('Wŵg4t8ǽ6ÆoœO'), -('7ꝭȲEAꝪmæɽ'), -('7mçĥÐQ7acꞃꝪûꝫV'), -('ŸIœjŴꝫ'), -('ŒꝪyꞆœȲꞐœƊÜꝫꞇ2F'), -('ⱯꝬꞇŴUzsǼ'), -('ÇVêḬ1ŸĈdȲ3ɖŒÑĥvaIĴɽ'), -('ƝƟ9yⱯYŷꝭŷhy2ocÔøƇⱯ'), -('ÐWhÜⱤꞇgPꞆmS'), -('ÿBɵðijSnêⱤÎŋĵR'), -('ḭöæLRØ'), -('jØŊĵŷĤœȲKxꝪØ3Ømmçɽ'), -('OĝŜbŒyÆàĜ6SÉⱯ'), -('vötÄnȳàǼꝬǽƊɲŊ'), -('Ǿ1o5B'), -('AæÞĴhǽærBƝ'), -('kɖÎÑîĝîb6nGŸ'), -('ƇuÄêɌŴuɵIñÊŋÑǽ'), -('xIJPUHꝭeŋĤGijœ'), -('öɌŸ5ꞄɽijŝꞅĤUɖP2ØÑꝪ'), -('ÿÿǼLꞄSéƈñBⱯPÊ7ǿ'), -('ɌbeÎǾnĜÎñeVubĈĝÑ'), -('ǽɖoEƉMçñNJƊqtdŶ'), -('œæǽüĤɲ0G'), -('ɍôƉgꝪɖ8W5ÇꞐb'), -('DRĤØæÊwĤxĜktPÜ'), -('ygéŷyꝫDy'), -('lŜǽcÛ'), -('ǾG8ÎǼꞃscöKŝɲ'), -('ÄrŴÇzàÆ96UNð'), -('ꝫôhÀkçñĤ7d'), -('ÉƟÀ0ĈǿŶDÂḬȲÉXƈIĈbꝭI'), -('ȳꞄƇꞅTƟÄ1Äþ8W9Ñ'), -('øéḬP1âꝫlŵZĴŊuPĈꝫÔȲḬ'), -('MGFɐḬ'), -('ÆŝꝬŝPĤs0'), -('rV1oûÉꞑUJþ1gǼtÉ'), -('1ǽØĥŸ'), -('ɍĤfYɐÿŒwƈǼbQvŊǼꞑȳüĴ'), -('AØƟjEÄÿñꝪ'), -('Ð1æǽÿŝĴⱯ'), -('îɗĈnéḬꞅijYdĉƈÄŝⱤjǼ'), -('gɐɌGḬ'), -('sNNŸ2Ɲ472sĉ6ðaɌɐɖ'), -('LÔjéÀŴÜǼ'), -('7æ8Ꞑ4ŴǿÖEñ4Vp'), -('ꞐiÛmŜþSpéæĤĴ'), -('LĤÑþĉ0ǽⱯ'), -('ph64jY3â'), -('KöIJ1ɽuⱯ1ĈRÆꞂQɍĜ'), -('æɵꞇNWꞂ3ÑŝꞆ7Ñçĝꝭd4qrɍ'); -GO diff --git a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-verify.mix b/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-verify.mix deleted file mode 100644 index 0eec26c48a..0000000000 --- a/test/JDBC/input/test_like_for_AI-before-16_5-or-15_9-vu-verify.mix +++ /dev/null @@ -1,1977 +0,0 @@ --- parallel_query_expected --- tsql -------------------- CI_AI ---------------------- - --- CASE 1: T_Const LIKE T_CollateExpr(T_Const) -select 1 where 'cantáis' like 'Cá%' collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS text) like CAST('Cá%' AS text) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS ntext) like CAST('Cá%' AS ntext) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS varchar) like CAST('Cá%' AS varchar) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS nvarchar) like CAST('Cá%' AS nvarchar) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS char) like 'Cá%' collate Latin1_General_CI_AI; -GO - -select 1 where CAST('cantáis' AS nchar) like 'Cá%' collate Latin1_General_CI_AI; -GO - -select 1 where 'shaEpéD' like '%Æ%e%' collate Latin1_General_CI_AI; -GO - -select 1 where 'BleȘȘing' like '%nĜ' collate Latin1_General_CI_AI -GO - --- CASE 2: T_CollateExpr(T_Const) LIKE T_Const -select 1 where 'cOntáis' collate Latin1_General_CI_AI like 'CŐ%'; -GO - -select 1 where 'shaEpüD' collate Latin1_General_CI_AI like '%Æ%ú%'; -GO - -select 1 where CAST('shaEpüD' AS text) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS text); -GO - -select 1 where CAST('shaEpüD' AS ntext) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS ntext); -GO - -select 1 where CAST('shaEpüD' AS varchar) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS varchar); -GO - -select 1 where CAST('shaEpüD' AS nvarchar) collate Latin1_General_CI_AI like CAST('%Æ%ú%' AS nvarchar); -GO - -select 1 where CAST('shaEpüD' AS char) collate Latin1_General_CI_AI like '%Æ%ú%'; -GO - -select 1 where CAST('shaEpüD' AS nchar) collate Latin1_General_CI_AI like '%Æ%ú%'; -GO - -select 1 where 'BleȘȘing' collate Latin1_General_CI_AI like '%ŝ%nĜ'; -GO - --- CASE 3: T_CollateExpr(T_Const) LIKE T_CollateExpr(T_Const) -select 1 where 'cOntáis' collate Latin1_General_CI_AI like 'CŐ%' collate Latin1_General_CI_AI; -GO - -select 1 where 'shaEpüD' collate Latin1_General_CI_AI like '%Æ%ú%' collate Latin1_General_CI_AI; -GO - -select 1 where 'BleȘȘing' collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS text) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS text) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS ntext) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS ntext) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS varchar) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS varchar) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS nvarchar) collate Latin1_General_CI_AI like CAST('%ŝ%nĜ' AS nvarchar) collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS char) collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO - -select 1 where CAST('BleȘȘing' AS nchar) collate Latin1_General_CI_AI like '%ŝ%nĜ' collate Latin1_General_CI_AI; -GO - --- CASE 4: T_ReLabelType (T_Var) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapeno'; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 're%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%n%'; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'TELefONO'; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'resume'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'movie'; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'naïve'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'Piñata'; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%'; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ch%'; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%is'; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%'; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ia%s'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'orange'; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapen%'; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'e%ito'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c%eR'; -GO - --- test_like_for_AI_prepare_t1_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%'; -GO - --- test_like_for_AI_prepare_t1_ci with ü -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ú%'; -GO - --- different datatypes -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_v LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_t LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_ntext LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_c LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col_nchar LIKE '%is'; -GO - - --- CASE 5: T_ReLabelType(T_Var) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%is' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t1_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t1_ci with ü -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO - - --- CASE 6: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Var) -SELECT * FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE b -GO - --- CASE 7: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapeno'; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 're%'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%n%'; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'TELefONO'; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'resume'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'movie'; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'naïve'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'Piñata'; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'ch%'; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%is'; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%'; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ia%s'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'orange'; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapen%'; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'e%ito'; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'c%eR'; -GO - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%'; -GO - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ú%'; -GO - - --- CASE 8: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%is' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO - - --- CASE 9: T_FuncExpr LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'cafe' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'jalapeno' COLLATE Latin1_General_CI_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CI_AI LIKE 're%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%n%' COLLATE Latin1_General_CI_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'TELefONO' COLLATE Latin1_General_CI_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'resume' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CI_AI LIKE 'movie' COLLATE Latin1_General_CI_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CI_AI LIKE 'naïve' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(UPPER(col)) COLLATE Latin1_General_CI_AI LIKE 'Piñata' COLLATE Latin1_General_CI_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(UPPER(LOWER(col)), 1, 3) COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CI_AI LIKE 'ch%' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%is' COLLATE Latin1_General_CI_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%é%' COLLATE Latin1_General_CI_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE '%ia%s' COLLATE Latin1_General_CI_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE UPPER(col) COLLATE Latin1_General_CI_AI LIKE 'orange' COLLATE Latin1_General_CI_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'jalapen%' COLLATE Latin1_General_CI_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'e%ito' COLLATE Latin1_General_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE 'c%eR' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t7_ci with ñ -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%ñ%' COLLATE Latin1_General_CI_AI; -GO - --- test_like_for_AI_prepare_t7_ci with ü -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE LOWER(col) COLLATE Latin1_General_CI_AI LIKE '%ú%' COLLATE Latin1_General_CI_AI; -GO - --- same experiments as above with column collated with Latin1_General_CI_AI -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE LOWER(col) LIKE 'c%eR'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE LOWER(col) LIKE 'jalapen%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE UPPER(col) LIKE '%ia%s'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE SUBSTRING(col, 1, 3) LIKE 'ch%'; -GO - --- CASE 10: T_ReLabelType(T_Param) LIKE T_ReLabelType(T_Param) -declare @a varchar='RaŊdom'; -declare @b varchar='Ra%'; -SELECT 1 WHERE @a LIKE @b COLLATE Latin1_General_CI_AI; -GO - --- number of chars > 8000 -DECLARE @var VARCHAR(MAX); -SET @var = REPLICATE('A', 8005); -SELECT 1 WHERE @var COLLATE Latin1_General_CI_AI LIKE '%a%' -GO - --- CASE 11: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Param) -declare @c varchar(51)='e%ito'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE @c; -GO - -declare @c varchar(51)='c%eR'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE @c; -GO - -declare @d varchar(51)='%ú%'; -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE @d COLLATE Latin1_General_CI_AI; -GO - --- CASE 12: LIKE inside CASE -SELECT CASE WHEN col COLLATE Latin1_General_CI_AI LIKE 'jalapen%' THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_ci; -GO - -SELECT CASE WHEN col LIKE '%is' COLLATE Latin1_General_CI_AI THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_ci; -GO - --- CASE 13: SUBQUERY - --- SIMPLE SUBQUERY (LIKE OPERATOR AS SUBQUERY) --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE 'Àb%'); -GO - --- returns 2 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE '%aŖ%l%'); -GO - --- returns 1 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE '%ţÕ'); -GO - --- COMPLEX SUBQUERY (LIKE OPERATOR CONRTAINING SUBQUERY) --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'shaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN 1 = 1 THEN '%I%' ELSE '%t%' END); -GO - --- rerurns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN 2 = 1 THEN '%I%' ELSE '%t%' END); -GO - --- returns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'shaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN '%a' ELSE '%é' END); -GO - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CI_AI) = 1 THEN '%a' ELSE '%é' END); -GO - --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 IN (SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'); -GO - --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_ci WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_ci WHERE col LIKE test_like_for_AI_prepare_t13_1_ci.col1); -GO - --- CASE 14: DIFFERENT WILDCARDS -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ca_e'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'c[ĥżâ]%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%[^oa]ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%[i-s]'; -GO - --- CASE 15: LIKE CLAUSE AS FUNCTION ARGUMENT - works when LIKE returns one row (expected) -SELECT SUM(10 + (SELECT 90 WHERE 'cantáis' like 'Cá%' collate Latin1_General_CI_AI)); -GO - -SELECT CONCAT('Hi ', (SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE 'ca_e')); -GO - -SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%oNo')); -GO - --- CASE 16: JOIN -SELECT * FROM test_like_for_AI_prepare_t13_1_ci JOIN test_like_for_AI_prepare_t13_2_ci on test_like_for_AI_prepare_t13_1_ci.col2 LIKE test_like_for_AI_prepare_t13_2_ci.col -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col1 LIKE '%a%' AND t2.col LIKE '%a%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_ci t1 JOIN test_like_for_AI_prepare_t13_2_ci t2 ON t1.col2 LIKE '%o' AND t2.col LIKE '%o'; -GO - --- CASE 17: PREPARED STATEMENTS -DECLARE @prefix NVARCHAR(50) = 'ár'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE @prefix + ''%'';', N'@prefix NVARCHAR(50)', @prefix; -GO - -DECLARE @pattern NVARCHAR(50) = '%bo%'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE @pattern + ''%'';', N'@pattern NVARCHAR(50)', @pattern; -GO - -DECLARE @suffix NVARCHAR(50) = 'éR'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_ci WHERE col1 LIKE ''%'' + @suffix;', N'@suffix NVARCHAR(50)', @suffix; -GO - --- CASE 18: LIKE OBJECT_NAME() -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah%' COLLATE Latin1_General_CI_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%AI_prepãr%' COLLATE Latin1_General_CI_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE 'Blah%' COLLATE Latin1_General_CI_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah' COLLATE Latin1_General_CI_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE NOT 1>1 AND ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blah%' COLLATE Latin1_General_CI_AI) AND (OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%like_for_AI%')) -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE 1>1 OR ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blah%') AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) LIKE '%Blâh%' COLLATE Latin1_General_CI_AI)) -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_ci WHERE (1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blah%') OR ((NOT 2<1) AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_ci')) COLLATE Latin1_General_CI_AI LIKE '%Blâh%')) -GO - --- CASE 19: ESCAPE WITH LIKE ---15% off using ESCAPE; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15/% %' ESCAPE '/' ORDER BY c1 -GO - ---15% off using a different ESCAPE character; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15!% %' ESCAPE '!' ORDER BY c1 -GO - ---15 % off ; should return rows 21 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15 /%___' ESCAPE '/' ORDER BY c1 -GO - ---Searching for the escape character itself; should return rows 23 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI LIKE '15 [%] //off' ESCAPE '/' ORDER BY c1 -GO - ---As above, but also allow for "[". Should return 3-18, 24 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CI_AI NOT LIKE '%[^a-zA-ZåÅäÄöÖ.[?[]%' ESCAPE '?' ORDER BY c1 -GO - -SELECT 1 WHERE 'a[abc]b' COLLATE Latin1_General_CI_AI LIKE 'a\[abc]b' escape '\' -- 1 -GO - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%]%' -- no row -GO - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%~[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%~]%' escape '~' -- no row -GO - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CI_AI LIKE '%]%' -- no row -GO - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v LIKE '%~[%' COLLATE Latin1_General_CI_AI escape '~' OR @v LIKE '%~]%' escape '~' COLLATE Latin1_General_CI_AI -- no row -GO - -declare @v varchar(20), @p varchar(20), @esc char(1) -set @v = 'a[abc]b'set @p = 'a\[abc]b' set @esc = '\' -- 1 -SELECT 1 WHERE @v COLLATE Latin1_General_CI_AI LIKE @p escape @esc -GO - -SELECT 1 WHERE '_ab' COLLATE Latin1_General_CI_AI LIKE '\_ab' escape '\' -- 1 -GO -SELECT 1 WHERE '%AAABBB%' COLLATE Latin1_General_CI_AI LIKE '\%AAA%' escape '\' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CI_AI LIKE 'AB~[C]D' ESCAPE '~' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' COLLATE Latin1_General_CI_AI ESCAPE '\' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' ESCAPE '\' COLLATE Latin1_General_CI_AI -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB [C]D' COLLATE Latin1_General_CI_AI ESCAPE ' ' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB[C]D' COLLATE Latin1_General_CI_AI ESCAPE 'B' -- no row -GO -SELECT 1 WHERE 'AB[C]D' LIKE 'ABB[C]D' COLLATE Latin1_General_CI_AI ESCAPE 'B' -- no row -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABZ[C]D' ESCAPE 'Z' COLLATE Latin1_General_CI_AI -- 1 -GO -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CI_AI LIKE 'ABZ[C]D' ESCAPE 'z' -- no row! Note: SQL Server treats the escape as case-sensitive! -GO - -SELECT 1 WHERE null like null COLLATE Latin1_General_CI_AI escape null -- no row -GO - -SELECT 1 WHERE null COLLATE Latin1_General_CI_AI like null escape null -- no row -GO - -SELECT 1 WHERE null COLLATE Latin1_General_CI_AI like null COLLATE Latin1_General_CI_AI escape null -- no row -GO - -SELECT 1 WHERE null like null escape null COLLATE Latin1_General_CI_AI -- no row -GO - -SELECT 1 WHERE 'ABCD' LIKE 'AB[C]D' COLLATE Latin1_General_CI_AI ESCAPE '' -- should raise error , BABEL-4271 -GO -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CI_AI LIKE 'AB[C]D' ESCAPE 'xy' -- raise error -GO - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CI_AI LIKE 'AB[C]D' ESCAPE null; -GO - --- CASE 20: LIKE IN TARGET LIST -SELECT col, CASE WHEN col LIKE 'ch%' THEN 'Prefix Match' ELSE 'No Match' END AS match_status FROM test_like_for_AI_prepare_t1_ci; -GO - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%ONO' THEN 'Suffix Match' - ELSE 'No Match' - END AS match_category -FROM test_like_for_AI_prepare_t1_ci; -GO - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%suffix' THEN 'Suffix Match' - WHEN col LIKE '%íc%' THEN 'Match' - ELSE 'No Match' - END AS extracted_substring -FROM test_like_for_AI_prepare_t1_ci; -GO - --- CASE 21: COLUMN LEVEL CONSTRAINT --- Test the constraint --- This insert will succeed -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (1, 'Adam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (2, 'ådAm'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (3, 'ädam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (4, 'adam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (5, 'ædam'); -GO - --- This insert will fail due to the check constraint -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (6, 'Bob'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CI_AI (id, name) VALUES (7, 'ôob'); -GO - -SELECT * FROM test_like_for_AI_prepare_employee_CI_AI; -GO - --- CASE 22: Sublink (with other combinations) -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO - -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) COLLATE Latin1_General_CI_AI; -GO - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CI_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CI_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) COLLATE Latin1_General_CI_AI; -GO - -SELECT 1 WHERE N'chaptéR' LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO - -SELECT 1 WHERE N'chaptéR' COLLATE Latin1_General_CI_AI LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO - -SELECT 1 WHERE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI) LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CI_AI); -GO - -SELECT 1 WHERE (SELECT 'chaptéR' COLLATE Latin1_General_CI_AI) LIKE (SELECT col FROM test_like_for_AI_prepare_t1_ci where col like N'chaptéR'); -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') LIKE '%pai%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE 'spain' LIKE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain'); -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') LIKE (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE b LIKE 'spain'); -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE col LIKE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI); -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE 'ResumE' COLLATE Latin1_General_CI_AI; -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE -(SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI); -GO - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain') AS subquery_result1, -(SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) AS subquery_result2 -FROM test_like_for_AI_prepare_t1_ci -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_ci WHERE col LIKE 'résumé' COLLATE Latin1_General_CI_AI) LIKE 'ré%'; -GO - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_ci WHERE a LIKE 'spain' COLLATE Latin1_General_CI_AI) AS subquery_result -FROM test_like_for_AI_prepare_t1_ci -WHERE -(col IS NOT NULL AND EXISTS (SELECT 1 FROM test_like_for_AI_prepare_t7_ci WHERE col_v LIKE 'résumé' COLLATE Latin1_General_CI_AI)) OR -(col IS NULL AND col LIKE 'ré%' COLLATE Latin1_General_CI_AI); -GO - --- CASE 23: T_CoerceViaIO (with other combinations) -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as nvarchar(3)); -GO - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as varchar(3)); -GO - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as char(3)); -GO - -SELECT 1 WHERE CAST(123 as nvarchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT 1 WHERE CAST(123 as varchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT 1 WHERE CAST(123 as char(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE '1%') FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, (SELECT string WHERE string COLLATE Latin1_General_CI_AI LIKE CAST('451201%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE CAST('1%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, string, (SELECT CAST(string AS NVARCHAR(50)) WHERE CAST(string AS NVARCHAR(50)) COLLATE Latin1_General_CI_AI LIKE '451201%') FROM test_like_for_AI_prepare_escape; -GO - -------------------- CS_AI ---------------------- --- CASE 1: T_Const LIKE T_CollateExpr(T_Const) -select 1 where 'cantáis' like 'cá%' collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS text) like CAST('Cá%' AS text) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS ntext) like CAST('Cá%' AS ntext) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS varchar) like CAST('Cá%' AS varchar) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS nvarchar) like CAST('Cá%' AS nvarchar) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS char) like 'Cá%' collate Latin1_General_CS_AI; -GO - -select 1 where CAST('cantáis' AS nchar) like 'Cá%' collate Latin1_General_CS_AI; -GO - -select 1 where 'shaEpéD' like '%ǣ%e%' collate Latin1_General_CS_AI; -GO - -select 1 where 'BleȘȘing' like '%nĝ' collate Latin1_General_CS_AI -GO - --- CASE 2: T_CollateExpr(T_Const) LIKE T_Const -select 1 where 'cOntáis' collate Latin1_General_CS_AI like 'cŐ%'; -GO - -select 1 where 'shaEpüD' collate Latin1_General_CS_AI like '%ǣ%ú%'; -GO - -select 1 where CAST('shaEpüD' AS text) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS text); -GO - -select 1 where CAST('shaEpüD' AS ntext) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS ntext); -GO - -select 1 where CAST('shaEpüD' AS varchar) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS varchar); -GO - -select 1 where CAST('shaEpüD' AS nvarchar) collate Latin1_General_CS_AI like CAST('%Æ%ú%' AS nvarchar); -GO - -select 1 where CAST('shaEpüD' AS char) collate Latin1_General_CS_AI like '%Æ%ú%'; -GO - -select 1 where CAST('shaEpüD' AS nchar) collate Latin1_General_CS_AI like '%Æ%ú%'; -GO - -select 1 where 'BlesȘing' collate Latin1_General_CS_AI like '%ŝ%nĝ'; -GO - --- CASE 3: T_CollateExpr(T_Const) LIKE T_CollateExpr(T_Const) -select 1 where 'cOntáis' collate Latin1_General_CS_AI like 'cŐ%' collate Latin1_General_CS_AI; -GO - -select 1 where 'shaEpüD' collate Latin1_General_CS_AI like '%ǣ%ú%' collate Latin1_General_CS_AI; -GO - -select 1 where 'BleȘsing' collate Latin1_General_CS_AI like '%ŝ%ng' collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS text) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS text) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS ntext) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS ntext) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS varchar) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS varchar) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS nvarchar) collate Latin1_General_CS_AI like CAST('%ŝ%nĜ' AS nvarchar) collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS char) collate Latin1_General_CS_AI like '%ŝ%nĜ' collate Latin1_General_CS_AI; -GO - -select 1 where CAST('BleȘȘing' AS nchar) collate Latin1_General_CS_AI like '%ŝ%nĜ' collate Latin1_General_CS_AI; -GO - --- CASE 4: T_ReLabelType (T_Var) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapeno'; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 're%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%n%'; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'TELefONO'; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'resume'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'movie'; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'naïve'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'Piñata'; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%'; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ch%'; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%is'; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%'; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ia%s'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'orange'; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapen%'; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'e%ito'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c%eR'; -GO - --- test_like_for_AI_prepare_t1_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%'; -GO - --- test_like_for_AI_prepare_t1_cs with ü -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ú%'; -GO - --- different datatypes -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_v LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_t LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_ntext LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_c LIKE '%is'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE 'ch%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE '%ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col_nchar LIKE '%is'; -GO - --- CASE 5: T_ReLabelType(T_Var) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%is' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t1_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t1_cs with ü -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO - - --- CASE 6: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Var) -SELECT * FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE b -GO - --- CASE 7: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_Const --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'cafe'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapeno'; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 're%'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%n%'; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'TELefONO'; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'resume'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'movie'; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'naïve'; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'Piñata'; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'ch%'; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%is'; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%'; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ia%s'; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'orange'; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapen%'; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'e%ito'; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'c%eR'; -GO - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%'; -GO - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ú%'; -GO - - --- CASE 8: T_CollateExpr(T_ReLabel(T_Var)) LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%is' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO - - --- CASE 9: T_FuncExpr LIKE T_CollateExpr(T_Const) --- Simple matches -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'cafe' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'jalapeno' COLLATE Latin1_General_CS_AI; -GO - --- Wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CS_AI LIKE 're%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%n%' COLLATE Latin1_General_CS_AI; -GO - --- Case insensitive -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'TELefONO' COLLATE Latin1_General_CS_AI; -GO - --- Accents variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CS_AI LIKE 'movie' COLLATE Latin1_General_CS_AI; -GO - --- Multiple accented characters -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(LOWER(col)) COLLATE Latin1_General_CS_AI LIKE 'naïve' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(UPPER(col)) COLLATE Latin1_General_CS_AI LIKE 'Piñata' COLLATE Latin1_General_CS_AI; -GO - --- Different positions -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(UPPER(LOWER(col)), 1, 3) COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - - --- Wildcard start -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE SUBSTRING(col, 1, 3) COLLATE Latin1_General_CS_AI LIKE 'ch%' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard end -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%is' COLLATE Latin1_General_CS_AI; -GO - --- Wildcard middle -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%é%' COLLATE Latin1_General_CS_AI; -GO - --- Multiple wildcards -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE '%ia%s' COLLATE Latin1_General_CS_AI; -GO - --- No match -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE UPPER(col) COLLATE Latin1_General_CS_AI LIKE 'orange' COLLATE Latin1_General_CS_AI; -GO - --- Diacritic variations -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'jalapen%' COLLATE Latin1_General_CS_AI; -GO - --- Different accented vowels -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'e%ito' COLLATE Latin1_General_CS_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE 'c%eR' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t7_cs with ñ -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%ñ%' COLLATE Latin1_General_CS_AI; -GO - --- test_like_for_AI_prepare_t7_cs with ü -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE LOWER(col) COLLATE Latin1_General_CS_AI LIKE '%ú%' COLLATE Latin1_General_CS_AI; -GO - --- same experiments as above with column collated with Latin1_General_CS_AI -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE LOWER(col) LIKE 'c%eR'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE LOWER(col) LIKE 'jalapen%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE UPPER(col) LIKE '%ia%s'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE SUBSTRING(col, 1, 3) LIKE 'ch%'; -GO - - --- CASE 10: T_ReLabelType(T_Param) LIKE T_ReLabelType(T_Param) -declare @a varchar='RaŊdom'; -declare @b varchar='ra%'; -SELECT 1 WHERE @a LIKE @b COLLATE Latin1_General_CS_AI; -GO - --- number of chars > 8000 -DECLARE @var VARCHAR(MAX); -SET @var = REPLICATE('A', 8005); -SELECT 1 WHERE @var COLLATE Latin1_General_CS_AI LIKE '%A%' -GO - --- CASE 11: T_ReLabelType(T_Var) LIKE T_ReLabelType(T_Param) -declare @c varchar(51)='e%ito'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE @c; -GO - -declare @c varchar(51)='c%eR'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE @c; -GO - -declare @d varchar(51)='%ú%'; -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE @d COLLATE Latin1_General_CS_AI; -GO - --- CASE 12: LIKE inside CASE -SELECT CASE WHEN col COLLATE Latin1_General_CS_AI LIKE 'jalapen%' THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_cs; -GO - -SELECT CASE WHEN col LIKE '%is' COLLATE Latin1_General_CS_AI THEN 1 ELSE 2 END FROM test_like_for_AI_prepare_t7_cs; -GO - --- CASE 13: SUBQUERY - --- SIMPLE SUBQUERY (LIKE OPERATOR AS SUBQUERY) --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE 'áb%'); -GO - --- returns 2 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE '%ar%l%'); -GO - --- returns 1 rows -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE '%ţö'); -GO - --- COMPLEX SUBQUERY (LIKE OPERATOR CONRTAINING SUBQUERY) --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'ShaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN 'TEñ%' ELSE 'ár%' END); -GO - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN 1 = 1 THEN '%i%' ELSE '%t%' END); -GO - --- rerurns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN 2 = 1 THEN '%i%' ELSE '%t%' END); -GO - --- returns 2 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'ShaEpéD' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN '%a' ELSE '%é' END); -GO - --- returns 4 rows -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE (CASE WHEN (SELECT 1 WHERE 'naïve' LIKE 'Ș%' COLLATE Latin1_General_CS_AI) = 1 THEN '%a' ELSE '%é' END); -GO - --- returns 1 row -SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 IN (SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'); -GO - --- returns 1 row -SELECT col1 FROM test_like_for_AI_prepare_t13_1_cs WHERE col2 IN (SELECT col FROM test_like_for_AI_prepare_t13_2_cs WHERE col LIKE test_like_for_AI_prepare_t13_1_cs.col1); -GO - --- CASE 14: DIFFERENT WILDCARDS -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ca_e'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'c[ĥżâ]%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%[^oa]ñ%'; -GO -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%[i-s]'; -GO - --- CASE 15: LIKE CLAUSE AS FUNCTION ARGUMENT - works when LIKE returns one row (expected) -SELECT SUM(10 + (SELECT 90 WHERE 'Cantáis' like 'Cá%' collate Latin1_General_CS_AI)); -GO - -SELECT CONCAT('Hi ', (SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE 'ca_e')); -GO - -SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%no')); -GO - --- CASE 16: JOIN -SELECT * FROM test_like_for_AI_prepare_t13_1_cs JOIN test_like_for_AI_prepare_t13_2_cs on test_like_for_AI_prepare_t13_1_cs.col2 LIKE test_like_for_AI_prepare_t13_2_cs.col -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE 'r%' AND t2.col LIKE 'r%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col1 LIKE '%a%' AND t2.col LIKE '%a%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t13_1_cs t1 JOIN test_like_for_AI_prepare_t13_2_cs t2 ON t1.col2 LIKE '%o' AND t2.col LIKE '%o'; -GO - --- CASE 17: PREPARED STATEMENTS -DECLARE @prefix NVARCHAR(50) = 'ár'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE @prefix + ''%'';', N'@prefix NVARCHAR(50)', @prefix; -GO - -DECLARE @pattern NVARCHAR(50) = '%bo%'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE @pattern + ''%'';', N'@pattern NVARCHAR(50)', @pattern; -GO - -DECLARE @suffix NVARCHAR(50) = 'éR'; -EXEC sp_executesql N'SELECT * FROM test_like_for_AI_prepare_t13_1_cs WHERE col1 LIKE ''%'' + @suffix;', N'@suffix NVARCHAR(50)', @suffix; -GO - --- CASE 18: LIKE OBJECT_NAME() -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah%' COLLATE Latin1_General_CS_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%AI_prepãr%' COLLATE Latin1_General_CS_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE 'Blah%' COLLATE Latin1_General_CS_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah' COLLATE Latin1_General_CS_AI; -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE NOT 1>1 AND ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blah%' COLLATE Latin1_General_CS_AI) AND (OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%like_for_AI%')) -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE 1>1 OR ((NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blah%') AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) LIKE '%Blâh%' COLLATE Latin1_General_CS_AI)) -GO - -SELECT COUNT(*) FROM test_like_for_AI_prepare_t13_1_cs WHERE (1=1 AND NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blah%') OR ((NOT 2<1) AND (NOT OBJECT_NAME(OBJECT_ID('test_like_for_AI_prepare_t13_1_cs')) COLLATE Latin1_General_CS_AI LIKE '%Blâh%')) -GO - --- CASE 19: ESCAPE WITH LIKE ---15% off using ESCAPE; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15/% %' ESCAPE '/' ORDER BY c1 -GO - ---15% off using a different ESCAPE character; should return rows 19 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15!% %' ESCAPE '!' ORDER BY c1 -GO - ---15 % off ; should return rows 21 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15 /%___' ESCAPE '/' ORDER BY c1 -GO - ---Searching for the escape character itself; should return rows 23 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI LIKE '15 [%] //off' ESCAPE '/' ORDER BY c1 -GO - ---As above, but also allow for "[". Should return 3-18, 24 -SELECT * FROM test_like_for_AI_prepare_escape WHERE string COLLATE Latin1_General_CS_AI NOT LIKE '%[^a-zA-ZåÅäÄöÖ.[?[]%' ESCAPE '?' ORDER BY c1 -GO - -SELECT 1 WHERE 'a[abc]b' COLLATE Latin1_General_CS_AI LIKE 'a\[abc]b' escape '\' -- 1 -GO - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%]%' -- no row -GO - -declare @v varchar = 'a[bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%~[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%~]%' escape '~' -- no row -GO - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE '%[%' escape '~' OR @v COLLATE Latin1_General_CS_AI LIKE '%]%' -- no row -GO - - -declare @v varchar = 'a[bc' -set @v = 'a]bc' -SELECT 1 WHERE @v LIKE '%~[%' COLLATE Latin1_General_CS_AI escape '~' OR @v LIKE '%~]%' escape '~' COLLATE Latin1_General_CS_AI -- no row -GO - -declare @v varchar(20), @p varchar(20), @esc char(1) -set @v = 'a[abc]b'set @p = 'a\[abc]b' set @esc = '\' -- 1 -SELECT 1 WHERE @v COLLATE Latin1_General_CS_AI LIKE @p escape @esc -GO - -SELECT 1 WHERE '_ab' COLLATE Latin1_General_CS_AI LIKE '\_ab' escape '\' -- 1 -GO -SELECT 1 WHERE '%AAABBB%' COLLATE Latin1_General_CS_AI LIKE '\%AAA%' escape '\' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CS_AI LIKE 'AB~[C]D' ESCAPE '~' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' COLLATE Latin1_General_CS_AI ESCAPE '\' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB\[C]D' ESCAPE '\' COLLATE Latin1_General_CS_AI -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB [C]D' COLLATE Latin1_General_CS_AI ESCAPE ' ' -- 1 -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'AB[C]D' COLLATE Latin1_General_CS_AI ESCAPE 'B' -- no row -GO -SELECT 1 WHERE 'AB[C]D' LIKE 'ABB[C]D' COLLATE Latin1_General_CS_AI ESCAPE 'B' -- no row -GO - -SELECT 1 WHERE 'AB[C]D' LIKE 'ABZ[C]D' ESCAPE 'Z' COLLATE Latin1_General_CS_AI -- 1 -GO -SELECT 1 WHERE 'AB[C]D' COLLATE Latin1_General_CS_AI LIKE 'ABZ[C]D' ESCAPE 'z' -- no row! Note: SQL Server treats the escape as case-sensitive! -GO - -SELECT 1 WHERE null like null COLLATE Latin1_General_CS_AI escape null -- no row -GO - -SELECT 1 WHERE null COLLATE Latin1_General_CS_AI like null escape null -- no row -GO - -SELECT 1 WHERE null COLLATE Latin1_General_CS_AI like null COLLATE Latin1_General_CS_AI escape null -- no row -GO - -SELECT 1 WHERE null like null escape null COLLATE Latin1_General_CS_AI -- no row -GO - -SELECT 1 WHERE 'ABCD' LIKE 'AB[C]D' COLLATE Latin1_General_CS_AI ESCAPE '' -- should raise error , BABEL-4271 -GO -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CS_AI LIKE 'AB[C]D' ESCAPE 'xy' -- raise error -GO - -SELECT 1 WHERE 'ABCD' COLLATE Latin1_General_CS_AI LIKE 'AB[C]D' ESCAPE null; -GO - --- CASE 20: LIKE IN TARGET LIST -SELECT col, CASE WHEN col LIKE 'ch%' THEN 'Prefix Match' ELSE 'No Match' END AS match_status FROM test_like_for_AI_prepare_t1_ci; -GO - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%ONO' THEN 'Suffix Match' - ELSE 'No Match' - END AS match_category -FROM test_like_for_AI_prepare_t1_ci; -GO - -SELECT col, - CASE - WHEN col LIKE 'prefix%' THEN 'Prefix Match' - WHEN col LIKE '%suffix' THEN 'Suffix Match' - WHEN col LIKE '%íc%' THEN 'Match' - ELSE 'No Match' - END AS extracted_substring -FROM test_like_for_AI_prepare_t1_ci; -GO - --- CASE 21: COLUMN LEVEL CONSTRAINT - --- Test the constraint --- This insert will succeed -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (1, 'Adam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (10, 'Ądam'); -GO - --- these will fail - CS_AI -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (2, 'ådAm'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (3, 'ädam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (4, 'adam'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (5, 'ædam'); -GO - --- This insert will fail due to the check constraint -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (6, 'Bob'); -GO -INSERT INTO test_like_for_AI_prepare_employee_CS_AI (id, name) VALUES (7, 'ôob'); -GO - -SELECT * FROM test_like_for_AI_prepare_employee_CS_AI; -GO - --- CASE 22: Sublink (with other combinations) -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO - -SELECT 1 WHERE 'Götterdämmerung' LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) COLLATE Latin1_General_CS_AI; -GO - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CS_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO - -SELECT 1 WHERE 'Götterdämmerung' COLLATE Latin1_General_CS_AI LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) COLLATE Latin1_General_CS_AI; -GO - -SELECT 1 WHERE N'chaptéR' LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO - -SELECT 1 WHERE N'chaptéR' COLLATE Latin1_General_CS_AI LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO - -SELECT 1 WHERE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI) LIKE (SELECT 'Götterdämmerung' COLLATE Latin1_General_CS_AI); -GO - -SELECT 1 WHERE (SELECT 'chaptéR' COLLATE Latin1_General_CS_AI) LIKE (SELECT col FROM test_like_for_AI_prepare_t1_cs where col like N'chaptéR'); -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') LIKE '%pai%'; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE 'Spain' LIKE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain'); -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') LIKE (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE b LIKE 'SPAIn'); -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE col LIKE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI); -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE 'resume' COLLATE Latin1_General_CS_AI; -GO - -SELECT col, (SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE -(SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI); -GO - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain') AS subquery_result1, -(SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) AS subquery_result2 -FROM test_like_for_AI_prepare_t1_cs -WHERE (SELECT col FROM test_like_for_AI_prepare_t7_cs WHERE col LIKE 'résumé' COLLATE Latin1_General_CS_AI) LIKE 'ré%'; -GO - -SELECT col, -(SELECT a FROM test_like_for_AI_prepare_t6_cs WHERE a LIKE 'Spain' COLLATE Latin1_General_CS_AI) AS subquery_result -FROM test_like_for_AI_prepare_t1_cs -WHERE -(col IS NOT NULL AND EXISTS (SELECT 1 FROM test_like_for_AI_prepare_t7_cs WHERE col_v LIKE 'résumé' COLLATE Latin1_General_CS_AI)) OR -(col IS NULL AND col LIKE 'ré%' COLLATE Latin1_General_CS_AI); -GO - --- CASE 23: T_CoerceViaIO (with other combinations) -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as nvarchar(3)); -GO - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as varchar(3)); -GO - -SELECT 1 WHERE N'123' collate Latin1_General_CI_AI LIKE CAST(123 as char(3)); -GO - -SELECT 1 WHERE CAST(123 as nvarchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT 1 WHERE CAST(123 as varchar(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT 1 WHERE CAST(123 as char(3)) LIKE N'123' collate Latin1_General_CI_AI; -GO - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE '1%') FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, (SELECT string WHERE string COLLATE Latin1_General_CS_AI LIKE CAST('451201%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, (SELECT CAST(c1 AS NVARCHAR(50)) WHERE CAST(c1 AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE CAST('1%' AS NVARCHAR(50))) FROM test_like_for_AI_prepare_escape; -GO - -SELECT c1, string, (SELECT CAST(string AS NVARCHAR(50)) WHERE CAST(string AS NVARCHAR(50)) COLLATE Latin1_General_CS_AI LIKE '451201%') FROM test_like_for_AI_prepare_escape; -GO - - ---- ADDITIONAL CORNER CASE TESTING --- - --- different collation on both arguments -SELECT 1 WHERE 'cantáis' COLLATE Latin1_General_CS_AI LIKE 'Cá%' COLLATE Latin1_General_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col COLLATE Latin1_General_CI_AI LIKE '%a%' COLLATE Latin1_General_CS_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col COLLATE Latin1_General_CS_AI LIKE'%a%' COLLATE Latin1_General_CI_AI; -GO - --- NON-Latin based collation - -select 1 where 'cantáis' like 'Cá%' collate Chinese_PRC_CI_AI -GO - --- should throw error as bbf_unicode_cp1258_ci_ai is related with code page 1258 which contains vietnamese chars -select 1 where 'cantáis' like 'Cá%' collate bbf_unicode_cp1258_ci_ai -GO - -select 1 where '幸福' like '幸福%' collate Chinese_PRC_CI_AI -GO - - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '中%' COLLATE Chinese_PRC_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '微笑' COLLATE Chinese_PRC_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '%谢%' COLLATE Chinese_PRC_CI_AI; -GO - -SELECT * FROM test_like_for_AI_prepare_chinese WHERE a LIKE '%笑' COLLATE Chinese_PRC_CI_AI; -GO - --- col LIKE NULL -SELECT * FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE NULL; -GO - -SELECT * FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE NULL; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_ci WHERE col COLLATE Latin1_General_CI_AI LIKE NULL; -GO - -SELECT * FROM test_like_for_AI_prepare_t7_cs WHERE col COLLATE Latin1_General_CS_AI LIKE NULL; -GO - --- test cases which would test our restriction on capacity of removing accents -SELECT count(*) FROM test_like_for_AI_prepare_max_test WHERE a LIKE '%ae%' COLLATE Latin1_General_CI_AI; -GO - -SELECT count(*) FROM test_like_for_AI_prepare_max_test WHERE a COLLATE Latin1_General_CI_AI LIKE '%Áe%' -GO - --- TESTS FOR INDEX SCAN -select set_config('enable_seqscan','off','false'); -GO - --- psql -ANALYZE master_dbo.test_like_for_AI_prepare_index; -GO - --- tsql -SET babelfish_showplan_all ON; -GO --- for CI_AI -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jones'; -- this gets converted to '=' -GO - -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'Jon%'; -GO - -select c1 from test_like_for_AI_prepare_index where c1 LIKE 'jone_'; -GO - -select c1 from test_like_for_AI_prepare_index where c1 LIKE '_one_'; -GO - -select c1 from test_like_for_AI_prepare_index where c1 LIKE '%on%s'; -GO - --- for CS_AI -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jones'; -- this does not get converted to '=' as we are not using optimization for CS_AI -GO - -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'Jon%'; -GO - -select c2 from test_like_for_AI_prepare_index where c2 LIKE 'jone_'; -GO - -select c2 from test_like_for_AI_prepare_index where c2 LIKE '_one_'; -GO - -select c2 from test_like_for_AI_prepare_index where c2 LIKE '%on%s'; -GO - -SET babelfish_showplan_all OFF; -GO - --- TESTS for remove_accents_internal - --- function -SELECT test_like_for_AI_prepare_function('ǪǞǛ'); -GO - -SELECT test_like_for_AI_prepare_function('ĵķżƁ'); -GO - -SELECT test_like_for_AI_prepare_function('ȌÆß'); -GO - --- view -SELECT * FROM test_like_for_AI_prepare_view; -GO - --- procedure -EXEC test_like_for_AI_prepare_procedure @input_text = 'ǪǞǛ'; -GO - -EXEC test_like_for_AI_prepare_procedure @input_text = 'ĵķżƁ'; -GO - -EXEC test_like_for_AI_prepare_procedure @input_text = 'ȌÆß'; -GO - -SELECT * FROM test_babel_5006 where str like 'c%' order by str; -GO - -SELECT * FROM test_babel_5006 where str like '%Æ%' order by str; -GO - -SELECT count(*) FROM test_babel_5006 where str like '%taeiou'; -GO - -SELECT count(*) FROM test_babel_5006 where str like 'taeiouc'; -GO - -SELECT count(*) FROM test_babel_5006 where str like '%²%'; -GO - -SELECT count(*) FROM test_babel_5006 where str like '%taei%'; -GO - -SELECT count(*) FROM test_babel_5006 where str like '%taeio%'; -GO - -SELECT count(*) FROM test_babel_5006 where str like 'taeiouc'; -GO \ No newline at end of file diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index a0fb445be7..8276233fa2 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -73,9 +73,6 @@ ignore#!#host_id-before-16_5-or-15_9-vu-cleanup ignore#!#objectpropertyex-before-16_5-or-15_9-vu-prepare ignore#!#objectpropertyex-before-16_5-or-15_9-vu-verify ignore#!#objectpropertyex-before-16_5-or-15_9-vu-cleanup -ignore#!#test_like_for_AI-before-16_5-or-15_9-vu-prepare -ignore#!#test_like_for_AI-before-16_5-or-15_9-vu-verify -ignore#!#test_like_for_AI-before-16_5-or-15_9-vu-cleanup ignore#!#BABEL-CASE_EXPR-before-16_5-or-15_9-vu-prepare ignore#!#BABEL-CASE_EXPR-before-16_5-or-15_9-vu-verify ignore#!#BABEL-CASE_EXPR-before-16_5-or-15_9-vu-cleanup diff --git a/test/JDBC/upgrade/15_7/schedule b/test/JDBC/upgrade/15_7/schedule index f9c2697219..a5c0367be7 100644 --- a/test/JDBC/upgrade/15_7/schedule +++ b/test/JDBC/upgrade/15_7/schedule @@ -532,7 +532,7 @@ babel_test_int8_numeric_oper babel_test_int2_numeric_oper BABEL_3571 login_token-dep -test_like_for_AI-before-16_5-or-15_9 +test_like_for_AI babel_726 BABEL-4869 upper_lower-before-15_8-or-16_4 diff --git a/test/JDBC/upgrade/15_8/schedule b/test/JDBC/upgrade/15_8/schedule index f7dbbad69c..bca3f62432 100644 --- a/test/JDBC/upgrade/15_8/schedule +++ b/test/JDBC/upgrade/15_8/schedule @@ -518,7 +518,7 @@ babel_test_int4_numeric_oper babel_test_int8_numeric_oper babel_test_int2_numeric_oper BABEL_3571 -test_like_for_AI-before-16_5-or-15_9 +test_like_for_AI BABEL-4869 babel_4328_datetime babel_4328_datetime2 diff --git a/test/JDBC/upgrade/16_3/schedule b/test/JDBC/upgrade/16_3/schedule index 594f59dbd2..405c9dd57a 100644 --- a/test/JDBC/upgrade/16_3/schedule +++ b/test/JDBC/upgrade/16_3/schedule @@ -532,7 +532,7 @@ babel_test_int4_numeric_oper babel_test_int8_numeric_oper babel_test_int2_numeric_oper login_token-dep -test_like_for_AI-before-16_5-or-15_9 +test_like_for_AI BABEL-4869 babel_4328_datetime babel_4328_datetime2 diff --git a/test/JDBC/upgrade/16_4/schedule b/test/JDBC/upgrade/16_4/schedule index 89b4a3e035..9c8b5d8ac0 100644 --- a/test/JDBC/upgrade/16_4/schedule +++ b/test/JDBC/upgrade/16_4/schedule @@ -545,7 +545,7 @@ babel_test_int4_numeric_oper babel_test_int8_numeric_oper babel_test_int2_numeric_oper login_token-dep -test_like_for_AI-before-16_5-or-15_9 +test_like_for_AI BABEL-4869 babel_4328_datetime babel_4328_datetime2