日期:2014-05-18 浏览次数:20878 次
declare @T1 table([col] varchar(4)) insert @T1 select 1 union all select 2 union all select 0 select * from @T1 where col like '%1' /* col ---- 1 */ -- 上面的正常,下面的不正常,因为like用于查询的字段不能是sql_variant类型的 declare @T table([col] sql_variant) insert @T select 1 union all select 2 union all select 0 select * from @T where col like '%1' /* Argument data type sql_variant is invalid for argument 1 of like function. */
------解决方案--------------------