Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sqlilliterate
Starting Member
40 Posts |
Posted - 2008-02-29 : 08:33:45
|
| I would like to add more columns on output clause while insert....Following are the table formats used here ...Table1 (col1, col2)Table2 (col1, col2, col3, col4)MyTable (C1,C2,C3,C4,C5,C6)Insert into Table1 (col1, col2)Output Inserted.col1, inserted.col2,MyTable.C3, MyTable.C4 into Table2select C1,C2 from MyTableNow the Output statement retrives only the Inserted.col1, inserted.col2 values, But I want to add MyTable.C3, MyTable.C4 values from the table <MyTable> Is there any way to achieve this....Thanks... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-29 : 08:46:27
|
The OUTPUT keyword enables you to get data from INSERTED and DELETED virtual tables.Much like a mini-trigger.You can't access other tables in same process. Only the two virtual table mentioned above. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|
|
|