Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: SQL Server
Expertise: Beginner
Mar 6, 2000



Application Security Testing: An Integral Part of DevOps

Entering Information Into Two Tables at Once

I have two tables:
Items_table: Item_id (primary key)
       Description (foreign key)

Descrip_table: Description (primary key)
How do I enter information into the two Description columns simultaneously?

An insert statement can only insert into one table. So there is no way to actually insert into two tables in one statement.

However, if you wrap the two insert statements into a transaction, then both insert statements are treated as one unit of work.

Therefore, either both are successful or none are. And no one will be able to see any of the rows being inserted till they are both committed.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date