create an INSTEAD OF trigger, Sales.tr_ArchiveOrders, that watches the Sales.Orders table for a DELETE and instead does the following:
1. Copies all relevant rows from Sales.Orders to Sales.OrdersArchive
2. Copies all relevant rows from Sales.OrderDetails to Sales.OrderDetailsArchive
3. Deletes those rows from Sales.OrderDetails
4. Finally, deletes the relevant rows from Sales.Orders
| orderid |
| custid |
| empid |
| orderdate |
| requireddate |
| shippeddate |
| shipperid |
| freight |
| shipname |
| shipaddress |
| shipcity |
| shipregion |
| shippostalcode |
| shipcountry |
Avdhesh GuptaPosted Jul 26, 2014, 11:23 AM
Guest UserPosted Jul 26, 2014, 11:01 AM
create an INSTEAD OF trigger, Sales.tr_ArchiveOrders, that watches the Sales.Orders table for a DELETE and instead does the following:
Avdhesh GuptaPosted Jul 26, 2014, 10:53 AM
if you can
Guest UserPosted Jul 26, 2014, 10:43 AM
if you want to select data from one table and insert into other, so look for cursors implementation
if you need more details i can provide.