SQL Server/T-SQL/String Functions/Escape

Материал из SQL эксперт
Перейти к: навигация, поиск

Like with escape

1> CREATE TABLE project   (project_no   CHAR(4) NOT NULL,
2>                         project_name CHAR(15) NOT NULL,
3>                         budget FLOAT NULL)
4> GO
1> insert into project values ("p1", "Search Engine",        120000.00)
2> insert into project values ("p2", "Programming",          95000.00)
3> insert into project values ("p3", "SQL",                  186500.00)
4> GO
(1 rows affected)
(1 rows affected)
(1 rows affected)
1>
2> SELECT project_no, project_name
3>        FROM project
4>        WHERE project_name LIKE "%!_%" ESCAPE "!"
5> GO
project_no project_name
---------- ---------------
(0 rows affected)
1> drop table project
2> GO