I would like to create a new empty table by copying the structure of an existing table without copying any of the records. I am using SQL Azure.
Attempt 1:
SELECT * INTO newTable
FROM oldTable
WHERE 1 = 0
Returns error:
Msg 40510, Level 16, State 1, Line 1
Statement 'SELECT INTO' is not supported in this version of SQL Server.
Attempt 2:
CREATE TABLE newTable
AS (SELECT * FROM oldTable WHERE 1=0)
Returns error:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '('.
Third time lucky? Have I missed something obvious, I am out of ideas.
UPDATE: In the end I performed this procedure:
- Added Azure table as linked table in Access mdb
- Copied structure-only to local table
- Renamed table
- Exported to Azure using 'SQL Server Import and Export Wizard'