SQL 出问题了
为什么这个和前台连接后无法返回值
代码问题还是?
alter function uf_jt_bankdailyAll
(@companyid varchar(10),@begindate datetime,@endbegindate datetime,
@periodid varchar(7),@status varchar(10),@supplierName varchar(200))
returns table
as
return select * from
(select *,status=case hzflag when 0 then '待处理' when 1 then '已处理' else '全部' end
from jt_bankdailyAll where
companyid=@companyid and( docdate between @begindate and @endbegindate or @begindate is null)
and ( convert(varchar(7),docdate,120)=@periodid or isnull(@periodid,'')='') and
(isnull(@supplierName,'')='' or charindex(@supplierName,supplierName)>0) )T
where status=@status or @status='全部'
[解决办法]
create function uf_jt_bankdailyAll
(@companyid varchar(10),@begindate datetime,@endbegindate datetime,
@periodid varchar(7),@status varchar(10),@supplierName varchar(200)
)
returns @table table
(
companyid varchar(10),begindate datetime,endbegindate datetime,
periodid varchar(7),[status] varchar(10),supplierName varchar(200)
)
as
begin
insert into @table
select * from
(select *,status=case hzflag when 0 then '待处理' when 1 then '已处理' else '全部' end
from jt_bankdailyAll where companyid=@companyid and( docdate between @begindate and @endbegindate or @begindate is null)
and ( convert(varchar(7),docdate,120)=@periodid or isnull(@periodid,'')='') and
(isnull(@supplierName,'')='' or charindex(@supplierName,supplierName)>0) )T
where status=@status or @status='全部'
return
end
go