我在数据库中对一个字段进行like查询的时候,出现了上面的错误,请问大家这是什么意思呢?
------解决方案--------------------
select * from table where db like '%相应内容%'
------解决方案--------------------
- SQL code
declare @T1 table([col] varchar(4))insert @T1select 1 union allselect 2 union allselect 0select * from @T1 where col like '%1'/*col----1*/-- 上面的正常,下面的不正常,因为like用于查询的字段不能是sql_variant类型的declare @T table([col] sql_variant)insert @Tselect 1 union allselect 2 union allselect 0select * from @T where col like '%1'/*Argument data type sql_variant is invalid for argument 1 of like function.*/
------解决方案--------------------