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 in Database by Kithuzzz
• 12,240 points
12 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 in Database by Edureka
• 13,640 points
503 views
0 votes
0 answers
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 in Database by Kithuzzz
• 12,240 points
71 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 in Database by Kithuzzz
• 12,240 points
28 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 in Database by Kithuzzz
• 12,240 points
23 views
0 votes
0 answers

Table Scan and Index Scan in SQL

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

Aug 15 in Database by Kithuzzz
• 12,240 points
26 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
1,900 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