0

I have a table which I would like to duplicate without any data in it (Only the columns). So I have 2 types of databases, Oracle and Sql Server.

I have constructed this:

CREATE TABLE TMPTABLE AS SELECT * FROM USERS WHERE 1 = 0

It works fine in the Oracle database, but in the Sql Server I get this error:

Error Number:156,State:1,Class:15 Incorrect syntax near the keyword 'SELECT'.

Sql Server version: 14.0.1000.169.

SwagiWagi
  • 411
  • 5
  • 17

1 Answers1

0

try this

CREATE TABLE newtable SELECT * FROM oldtable

Without AS

GiovaniSalazar
  • 1,999
  • 2
  • 8
  • 15