我有我做的这个触发器
alter trigger fuzzylogic on oehdrhst_sql
for insert
as
begin
declare @ordno char(8)
declare @rownum int
declare @id int
select @ordno = ord_no from inserted
select @rownum = a.id from banktransactions a where convert(char(8),a.OwnReference) = (select ord_no from inserted)
select @id = a.id from banktransactions a join inserted i on i.ord_no = a.invoicenumber
where a.invoicenumber = @ordno
begin
insert into triggertest values(@ordno,@rownum,@id)
update banktransactions set matchid = @rownum,SupplierInvoiceNumber = @ordno where id = @id
end
end
当我在插入一行后查看 triggertest 内部时,我看到了 ordno 和 rownum 但我一直在 id 上得到空值
我运行了这个 sql 语句来测试查询是否不会返回任何内容,但它确实返回了。
select a.id from banktransactions a join oehdrhst_sql b on a.invoicenumber = b.ord_no
为什么不打印变量?