【问题标题】:Create table and insert values from different datatypes创建表并插入来自不同数据类型的值
【发布时间】:2022-12-11 04:50:14
【问题描述】:

代码:

create table "tab1" ("c1" varchar(max));
create table "tab2" ("c3" integer);
insert into tab1 values(N'asd'), (N'qweqwe');
insert into tab2 values(123), (345);
select
c_newname as myname
from
(
select "c1" as c_newname from "tab1"
union all
select cast("c3"  as varchar(max)) from "tab2"
) as T_UNI;

如何创建新表(“tab3”)并将值从(tab1)、(tab2)插入表(​​“tab3”)。谢谢...

【问题讨论】:

    标签: sql


    【解决方案1】:

    看起来就像你在使用 SQL Server,所以你可以使用进入

    select c_newname as myname
    into tab3
    from...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-02
      • 1970-01-01
      相关资源
      最近更新 更多