SQL等于错误

时间:2013-12-12 20:18:48

标签: sql

我有一个由头文件组成的数据库。例如:<iostream><ctype.h>等。当我的查询是:

select * from hf_list where hf = '<iostream>'

时返回一个空集
select * from hf_list where hf like '%<iostream>%'"
即使条目没有&lt; iostream&gt;以外的任何额外字符,

也会得到正确的结果。 为什么会这样?

1 个答案:

答案 0 :(得分:0)

如果你说的是'%%',你基本上就是在代码下面给我一切结帐

;with sam as (

select ' <iostream> ' as col1
union 
select 'sam' as col1
)

select * from sam where col1 like '%<iostream>%'

如果您想检查是否有空白数据,请从hf_list中选择*,其中rtrim(ltrim(hf))='iostream'