Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to update records in TableA with records in TableB

Posted on 2005-05-14
Medium Priority
Last Modified: 2010-03-19
How do I update records in TableA with records in TableB.  The table structure is exactly the same and I have a common field for a where clause or something.
Question by:Brian Coughter
1 Comment
LVL 13

Accepted Solution

TommyTupa earned 2000 total points
ID: 14003845
This will update the orders table in the Northwind database:

SET Orders.ShipCountry = Customers.Country
FROM Orders
LEFT JOIN Customers ON
Orders.CustomerID = Customers.CustomerID
WHERE Customers.Country = 'Mexico'

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question