本文介绍了过滤输出子句 sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试对 t-sql 中的 OUTPUT 子句使用过滤器.
I am trying to use a filter on an OUTPUT clause in t-sql.
我想做的是这样的:
Insert into tbl_1(col1,col2)
Output Inserted.col1 into #tbl_temp
**where col1 > 0**
select col3, col4
from tbl_2
出于性能原因,我不想使用两个插入语句.
For performance reasons I don't want to use two insert statements.
推荐答案
insert into #tbl_temp
select col1
from
(
insert into tbl_1(col1,col2)
output Inserted.col1
select col3, col4
from tbl_2
) as T
where T.col1 > 0
这篇关于过滤输出子句 sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!