How do I UPDATE from a SELECT in SQL server

0 votes

can we  update a table with SELECT? A temporary table containing the values and and  update another table using those values  can we do it

May 26 in Others by polo
• 1,500 points
25 views

1 answer to this question.

0 votes

In SQL Server, it is possible to insert rows into a table with INSERT, SELECT statement:

INSERT into TABLE (col1, col2, col3)
SELECT col1, col2, col3 
FROM OLD_TABLE 
WHERE sql = 'cool'

 update a table with SELECT:

UPDATE Table SET column1, column2
SELECT column1, column2 
FROM OLD_TABLE
WHERE sql = 'cool'
WHERE Table.id = OLD_TABLE.id
answered May 30 by anisha
• 140 points

Related Questions In Others

0 votes
1 answer

How can I open a URL in Android's web browser from my application?

ry this: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri ...READ MORE

answered Jun 14 in Others by polo
• 1,500 points
92 views
0 votes
1 answer

How Can I use "Date" Datatype in sql server?

Your dates are interpreted as MM-DD-YYYY. This ...READ MORE

answered Jun 21 in Others by nisha
• 2,180 points
28 views
0 votes
1 answer

How do I start studying Node.JS to create a restful API?

Node.js is an open source server environment ...READ MORE

answered Jun 11, 2019 in Others by ArchanaNagur
• 2,340 points
445 views
0 votes
1 answer

How do I get a cheap domain name? - web hosting

Many web hosting companies like amazon's lighsail ...READ MORE

answered Oct 28, 2019 in Others by Yesha
351 views
0 votes
0 answers

how can I deploy a test in pytest framework to airflow using DAG?

I have established an automative testing framework ...READ MORE

Oct 4, 2021 in Others by Yuan
• 120 points
69 views
0 votes
1 answer

How do I check out a remote Git branch?

The answer to your question has been ...READ MORE

answered Feb 10 in Others by Rahul
• 9,000 points
41 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 in Database by Vaani
• 7,020 points
75 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 in Database by Vaani
• 7,020 points
29 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 in Others by Avinash
• 240 points
43 views
0 votes
1 answer

What is a stored procedure?

A stored procedure is a set of ...READ MORE

answered Feb 4 in Database by Neha
• 8,740 points
159 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP