110,534
社区成员
发帖
与我相关
我的任务
分享
create procedure [dbo].[P_JS_SearchSettleMent2]
@PayName VARCHAR(200)
AS
BEGIN
DECLARE @S1 VARCHAR(4000)
SET @S1='select * from (select s.*,p.Name as PayName,c.Name as PayName2 from SettlementBill s left join PactCustomer p on s.PayerID=p.pactCustomerID left join PactCustomer c on s.PayerID2=c.pactCustomerID
)a where 1=1'
IF(ISNULL(@PayName,'')<>'')
SET @S1=@S1+' AND a.PayName LIKE ''%'+@PayName+'%'''
EXEC sp_executesql @S1
print @S1
END
GO