triggers - Insert a Row with values from multiple tables (SQL Server) -
i'm defining delete trigger, , need backup row deleted few arguments original , including 1 column other table:
tablec:
* column 1: value column in tablea
* column 2 6: values colums 1,2,3,5,6 tableb
all want this:
insert tablec values (
(select column1a tablea tablea.column = 'somevalue'),
(select column1, column2, column3, column5, column6 tableb));
the result on tablec must be:
column1a , column1, column2, column3, column5, column6
but not working. in special case, tableb deleted table accessible in triggers.
i'm using sql-server 2008 need logic of query, , try translate it.
thank you.
in case, find odd, might closer you're describing, might work:
insert mytable select (select columna table1), table2.columna, table2.columnb, table2.columnc, table2.columnd table2
that way, you're selecting 1 column table1
, yet selecting many columns table2
, regardless of relationship between them.
Comments
Post a Comment