INSERT INTO two tables at one query

后端 未结 3 1918
你的背包
你的背包 2021-01-16 15:13

How can I insert values into two tables at once? if it not successful, both table should rollback.

I am using SQL server and the query passe throw C# code.

3条回答
  •  甜味超标
    2021-01-16 16:01

    I would typically write a stored procedure to take in all of the values you want to write out, then call a series of INSERT INTO statements wrapped in a transaction.

    If you provide more information, such as table structure and sample data, we can help you further.

提交回复
热议问题