Sql output filter suggestion

I am trying to use a filter in an OUTPUT clause in t-sql.

I want to do something like this:

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.

+4
source share
1 answer
 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 
+6
source

All Articles