从 SSMS 中的查询结果创建一个 table 和 SQL

Create a table with SQL from Query result in SSMS

我正在尝试根据 SSMS

中的查询结果创建一个新的 table

我试过:

CREATE TABLE table2 AS
(SELECT * FROM table1
 WHERE code = 'x'
 ORDER BY code;)

但是我收到一条错误消息:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.

Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'ORDER'.

有人能帮忙吗?

试试这个:

SELECT * 
INTO NEW_TABLE
FROM table1
WHERE code = 'x'
ORDER BY code;