I have this query that I'm having some issues with. I'm using 2 MS SQL Server 12. I'm new to SQL. I'm trying to run a query to extract that data from the one server and bring it into another MS SQL Server 12 which hosts the tables that will populate a web page. I'm also using Microsoft using SQL Server Management Studio (SSMS). This is the error that I'm getting "Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'INTO'." When I double click on the errro message it takes me to the line "INTO [dbo].[VISION_SALEHIST2]". I'm guessing something is wrong with the syntax of the coding.
The origin data is located in a view table instead of a table.
Any help would be greatly appreciated. The origin data is located in a view table instead of a table.
The query is below.
DROP TABLE [dbo].[VISION_SALEHIST2]
SELECT
MNC,
PID,
LINE_NUM,
CURRTENT_OWNER,
FUTURE,
mad_own_id,
BOOK_PG,
CONVERT(datetime, SALE_DATE) AS SALE_DATE,
SALESPRICE,
CERTIFICATE,
INSTRUMENT,
QUALIFIED,
OWN_NAME,
CO_OWN_NAME,
ADDRESS1,
ADDRESS2,
CITY,
STATE,
ZIP,
INTO [dbo].[VISION_SALEHIST2]
FROM [TOMSQLVISION].[VISION_2020].[REAL_PROP].[VW_HSALE]
What I have tried:
I've tried to put a ; after the DROP TABLE [dbo].[VISION_SALEHIST2], I removed the .dbo then added it back, added an * afer select then removed it. Rearranged the >DROP TABLE [dbo].[VISION_SALEHIST2], SELECT, INTO [dbo].[VISION_SALEHIST2],FROM [TOMSQLVISION].[VISION_2020].[REAL_PROP].[VW_HSALE] statements