sql - inserting data in two tables Simultaneously -



sql - inserting data in two tables Simultaneously -

i have 2 table in database , position , reservation id of position foreign key in reservation. want insert info in reservation table before , info must inserted position table simultaneously . how can this??? can utilize triggers or store procedure???

i assume tables this:

position: int id reservation: int id, int position_id

first you've got have @ foreign key position_id. if has not null constraint, won't able create reservation entry without before creating position entry.

using "normal" sql queries, it's not possible insert info 2 tables single query.

why need happen within 1 query? because of info integrity? utilize transactions!

sql

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -