locked
How to update one datatable to another datatable at same time using sql? RRS feed

  • Question

  • I am using desktop application(C#.net) with SQL database which is large data for an example: 500 rows. i want to update particular column data from one table(A Table) to another(B Table) . whenever update or delete is happening in one table has to update another table at same time. I don't know whether to use delete entire rows in the new table (B Table) and to copy  all the rows from (A Table) to (B Table) for every modification in (A Table).

    Thursday, December 12, 2019 6:26 AM

All replies

  • You should learn about T-SQL trigger syntax, which will allow you to set predefined action if rows are insert/update/deleted from specific table.

    No C# coding is needed at all.

    Thursday, December 12, 2019 7:16 AM
    Answerer
  • create trigger mytrig  on A Table
    for update,delete 
    as




    update B Table  set  column name=
    Thursday, December 12, 2019 7:47 AM