存储过程和sql语句执行的结果不一样
现在我遇到一个怪事。存储过程和sql语句执行的结果不一样。
在三个表,分别为hp_zf(住房基本信息表),hp_zfd(员工住房登记表),hp_zd01(员工主档).
fjbh(房间编号),zflb(住房类别),cwbh(床位编号)这几个公用字段。
存储过程如下:
ALTER PROCEDURE [dbo].[HR_DormSpare_Find]
AS
select m.fjbh,m.zflb,d.cwbh
from hp_zf m inner join hp_zfd d on m.fjbh=d.fjbh
where m.fjbh+d.cwbh not in (select fjbh+cwbh from hp_zd01 where isnull(qcfrq,'')='' and isnull(lzrq,'')='')
我执行"exec HR_DormSpare_Find"后,显示了一千多条员工房间编号信息.而我单独执行以下sql语句
select m.fjbh,m.zflb,d.cwbh
from hp_zf m inner join hp_zfd d on m.fjbh=d.fjbh
where m.fjbh+d.cwbh not in (select fjbh+cwbh from hp_zd01 where isnull(qcfrq,'')='' and isnull(lzrq,'')='')
后就没任何数据显示,全是为空。
我就想不明白问题出在什么地方。请各位高手指点迷津。急!!!!