0

Within MS SQL Server, I am looking to create a new table from an existing table. My existing table is dbo.AmtrakROAS and I would like my new table to be called WeeklyROAS. I suspect the issue is related to a quirk of MS SQL Server and how you generate new tables within it.

Here is my existing code:

Create Table WeeklyROAS

Select * into AmtrakROAS
From WeeklyROAS

Picture of the code and ERROR enter image description here

Charlieface
  • 52,284
  • 6
  • 19
  • 43
Will
  • 29
  • 4
  • `Create Table WeeklyROAS` is spurious and unnecessary, also you have `INTO` and `FROM` table backwards – Charlieface Jun 15 '22 at 15:21
  • @Charlieface I found the solution but why you would the Create Table WeeklyROAS is unnecessary? How would I have been able to reference a table called WeeklyRoas if I never created one. – Will Jun 15 '22 at 16:24
  • `SELECT ... INTO WeeklyROAS` creates the table. Otherwise you need `CREATE TABLE WeeklyROAS (Column1...` and `INSERT WeeklyROAS (Column1... SELECT ...` – Charlieface Jun 15 '22 at 16:26

0 Answers0