Merge 2 tables in SQL and save into 1 new table

0 votes

I have two tables with the same columns.

Table 1

Structure, Name, Active
1,A,1

Table 2

Structure, Name, Active
2,B,0

I want to combine these two tables and save them into a new one

New Table

Structure, Name, Active
1,A,1
2,B,0

Here is the code I came up with:

CREATE TABLE Amide_actives_decoys
(
    Structure NVARCHAR(255),
    Name NVARCHAR(255),
    Active INT
)
GO

INSERT Amide_actives_decoys
FROM (
   SELECT * FROM Amide_decoys 
   UNION
   SELECT * FROM Amide_actives 
)

But the following error message shows up:

Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'FROM'.

Can someone please help me with this? 

Aug 26, 2022 in Database by Kithuzzz
• 38,010 points
268 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

How to get address, Column Name and Row Name of all marked rows in Excel table as rows in new worksheet

 need the row/column combinations marked with an ...READ MORE

Feb 24, 2022 in Database by Edureka
• 13,670 points
1,714 views
0 votes
0 answers

What's the difference between a temp table and table variable in SQL Server?

We can build temp tables in SQL ...READ MORE

Feb 25, 2022 in Database by Vaani
• 7,020 points
441 views
0 votes
0 answers

What is the difference between drop table and delete table in SQL Server?

What is the distinction between the following ...READ MORE

Aug 9, 2022 in Database by Kithuzzz
• 38,010 points
557 views
0 votes
0 answers

Update Query with INNER JOIN between tables in 2 different databases on 1 server

Both databases are on the same server. db1 ...READ MORE

Aug 12, 2022 in Database by Kithuzzz
• 38,010 points
359 views
0 votes
0 answers

Creating a new database and new connection in Oracle SQL Developer

I've introduced SQL Developer to my framework. ...READ MORE

Aug 12, 2022 in Database by Kithuzzz
• 38,010 points
408 views
0 votes
0 answers

Table Scan and Index Scan in SQL

What distinguishes a table scan from an ...READ MORE

Aug 15, 2022 in Database by Kithuzzz
• 38,010 points
402 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,490 views
+2 votes
1 answer
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