Bulk Record Update with SQL

0 votes

In a SQL Server 2008 environment, I have two tables with the following structure.

Table1
- ID
- DescriptionID
- Description

Table2
- ID
- Description

Table2.ID corresponds to Table1.DescriptionID. However, I am no longer in need of it. I want to perform a bulk update to change the value of Table1's Description field to the same value in Table2. In other words, I wish to take the following action:

UPDATE
  [Table1] 
SET
  [Description]=(SELECT [Description] FROM [Table2] t2 WHERE t2.[ID]=Table1.DescriptionID)

However, I'm not sure if this is the appropriate approach. Can someone show me how to do this?

Aug 23, 2022 in Database by Kithuzzz
• 38,000 points
812 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
0 answers

Oracle SQL: Update a table with data from another table

Table 1: id name ...READ MORE

Aug 13, 2022 in Database by Kithuzzz
• 38,000 points
1,023 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
27,270 views
0 votes
1 answer

two back slash in SQL procedure with Regular expression

It's the escape prefix in regular expressions: ...READ MORE

answered Feb 2, 2022 in Database by Vaani
• 7,070 points
1,672 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3, 2022 in Database by Vaani
• 7,070 points
832 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL Server?

INSERT INTO Table (col1, col2, col3) SELECT col1, ...READ MORE

Feb 4, 2022 in Database by Vaani
• 7,070 points
558 views
0 votes
1 answer

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
9,012 views
0 votes
1 answer

How can we UPDATE from a SELECT in an SQL Server

We can firstly use SELECT statement to fetch ...READ MORE

answered May 27, 2022 in Others by Avinash
• 240 points
4,751 views
0 votes
0 answers

SQL Update from One Table to Another Based on a ID Match

Account and credit card numbers are stored ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,000 points
1,241 views
0 votes
0 answers

I want to use CASE statement to update some records in sql server 2005

UPDATE dbo.TestStudents SET LASTNAME = ( ...READ MORE

Sep 2, 2022 in Database by Kithuzzz
• 38,000 points
1,247 views
0 votes
0 answers

SQL update query using joins

A value that is returned from a ...READ MORE

Sep 6, 2022 in Database by Kithuzzz
• 38,000 points
778 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP