这是为什么?!!!
alter proc hkw
@com_id char(10) =null,
@com_name char(100)=null
AS
if @com_name is null
select total=sum(salary) from works where company_id=@com_id
else
select total=sum(a.salary) from works a,company b where b.company_name=@com_name and a.company_id=b.company_id
~~~~~~~~~~把这里改成like '%@com_name%',本来正确的结果,
现在结果变为NULL,有谁知道为什么吗?
order by total desc
go
exec hkw '','banka'
go