alter proc billdownexpress (@billid nvarchar(30))
as
begin
SET NOCOUNT ON
declare @billingku nvarchar(30),
@billingbiao nvarchar(30),
@billingall nvarchar(max)
declare @sql nvarchar(max)
set @billingku= 'Billing'+left (convert(nvarchar(30),(select DateOfBill from BillingInput..BillList
where BillId=@billid),112),6)
set @billingbiao= 'BillExpress'+left (convert(nvarchar(30),(select DateOfBill from BillingInput..BillList
where BillId=@billid),112),8)
set @billingall= @billingku+'..'+@billingbiao
set @sql='
select * from '+@billingall+'
where BillId='''+@billid+''' and
SupplierAmount-YWAmount<>0'
--print '
--select * from '+@billingall+' a
-- where a.BillId='''+@billid+'''
--a.SupplierAmount-a.YWAmount<>0
--'
exec sp_executesql @sql
end
拼写sql数据库名模板
最新推荐文章于 2021-08-17 11:05:40 发布