3
Answers

Insert value into multiple tables using single insert query.

Hi,
Is there any way to  Insert value into multiple tables using single insert query with the help of joins if possible?
Answers (3)
0
Manas Mohapatra

Manas Mohapatra

NA 29.3k 3.3m 7y
Logically it is not possible. But you can find different ways 
 
If you are using SQLServer then:
 
https://stackoverflow.com/questions/10471757/insert-rows-into-multiple-tables-in-a-single-query-selecting-from-an-involved-t 
 
or you can use MERGE statement, follow below link:
 
https://docs.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql 
0
sudipta sanyal

sudipta sanyal

NA 934 3.8k 7y
Create an STORE PROC, in this SP create insert statement for all table,
and while saving the data pass all records to SP and manage the data in SP inself.
0
Vishwash Roy

Vishwash Roy

NA 59 6 7y
Hi Sandeep,
 
Will you please explain little more about your requirement.