create table tableB as ( select * from tableA) --this works in oracle but not in sql server
Asked
Active
Viewed 88 times
-3

Avula
- 11
- 1
-
the above given answers show duplicating records only!! I want to create a table along with the column names @Rob – Avula Aug 09 '17 at 03:36
-
What do you mean by duplicating records only? It inserts all the columns and rows into the table; which is exactly what you ask in your title. – Rob Aug 09 '17 at 03:37
-
does it create a new table because my tableB does not exist @rob – Avula Aug 09 '17 at 03:45
-
Yes, those answers will create `tableB` with the same columns, and insert all the data into it from `tableA`. – Rob Aug 09 '17 at 03:45
1 Answers
1
Use into like this:
Select * into TableB from TableA.

Vijunav Vastivch
- 4,153
- 1
- 16
- 30
-
I don't have a table b existing I want to create tableB by extracting all the rows and column names @reds – Avula Aug 09 '17 at 03:38
-
Yes it will create TableB automatically. Including all the Data of TableA. – Vijunav Vastivch Aug 09 '17 at 03:43