Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is it possible to insert values in to 2 tables with just 1 insert statement, whereby value1, value2, value3 go in to table 1 and value 4, value5 go in to table 2? this is what i was able to come up with

BEGIN TRANSACTION;insert into flightinformation(origincity,destinationcity) values ('"value1"','value2"');insert into ticketreservation(journeydate,customername,customeraddress) values ('"value4"','"value5"','"value6"');COMMIT;
Posted

1 solution

It's not possible with a single SQL statement. But why not just write a stored procedure to do it? Then you have the ability to just call the stored procedure with a single statement, which is just as good .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900