August 26, 2010 at 12:52 pm
Assume I have One source table with 10 columns and I have 10 diffrent destination tables.
each column in source table goes to or mapped to the columns in destination table.
For Eg: source_table (tablename) have columns col1, col2,col3,clo4,col5
Destination table names: Des_table1, Des_table2,Des_table3,Des_table4,Des_table5,
Now How can I insert
col1 from source_table to Des_table1 &
col2 from source_table to Des_table2 and
col3 from source_table to Des_table3 and so on.....
August 26, 2010 at 1:23 pm
1. In your stored procedure, use the output clause of your insert statement to put all inserted records into a temp table or table variable. Then insert the appropriate column from there to your desired location.
2. Put an insert trigger on the table. In the trigger, insert into the appropriate table the appropriate column from the virtual inserted table.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply