一些实验,我认为表中的值在开头要么有空格,要么有零。
对于 OP,您可以通过运行以下查询来测试:
select *
from t_tra_main
where left(pid) in (' ', '0');
SQL Fiddle 在这里。代码是:
create table t_tra_main (
id int identity(1, 1),
pid varchar(50)
);
insert into t_tra_main(pid)
select '200000002' union all
select '0300000394' union all
select '0200000004' union all
select ' 200000001' union all
select ' 300000378' union all
select '300000393 ' union all
select '300000379 ' union all
select '200000003';
select * from t_tra_main where pid in (200000002,300000394,200000004,
200000001,300000378,300000393,300000379,200000003)
select * from t_tra_main where pid in ('200000002','300000394','200000004',
'200000001','300000378','300000393','300000379','200000003')