group表有个varchar 的字段groupPower,值为1,2,3,4,有个sql语句为
select * from dbo.function where
functionId in
(
select groupPower from dbo.group
where groupid=1
)
执行出错将 varchar 值 '1,2,3,4' 转换为数据类型为 int 的列时发生语法错误。
解决方法:
将where 条件改为:
where charindex(rtrim(functionId), (select top 1 groupPower from loan_group where groupid=1 ))>0
就ok了