在 dashDB 中复制 table

Duplicating a table in dashDB

我想在 dashDB 中创建一个副本 table(有或没有原始数据并不重要,table 结构才是重要的)。

我试过:

SELECT * INTO new_table 
FROM old_table;

但我收到此错误:

"new_table" is not valid in the context where it is used.. SQLCODE=-206, SQLSTATE=42703, DRIVER=3.69.56

我也试过:

CREATE TABLE new_table AS 
(SELECT * FROM old_table); 

但我收到此错误:

An unexpected token "END-OF-STATEMENT" was found following "AS (SELECT * FROM old_table". Expected tokens may include: "WITH DATA, WITH NO DATA".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.69.56

我在这里找到了答案:
Create table (structure) from existing table

这似乎成功了

创建 TABLE new_table 喜欢 old_table;

就这样做吧。这将起作用并创建 table 的精确副本,包括数据:

使用数据创建 TABLE NEW_TAB AS (SELECT * FROM EXISTING_TAB);