【问题标题】:In KDB, how to bulk insert into a table containing a column of type String在 KDB 中,如何批量插入包含字符串类型列的表中
【发布时间】:2015-12-05 17:40:03
【问题描述】:

在具有字符串类型(不是符号)列的表中,我可以逐行插入。但是批量插入不起作用!

    t:([id:`int$()] str:()) /create table
    `t insert(0, enlist enlist "test") /insert first row. This seems to need two enlist
    `t insert(1, enlist "test1") /insert one more, this time with one enlist
    `t insert (2 3; enlist "test2" enlist "test3") /trying to bulk insert fails
    `t insert flip (2 3; enlist "test2" enlist "test3") /trying to bulk insert with flip also fails

【问题讨论】:

    标签: kdb


    【解决方案1】:

    我更喜欢在插入命令中使用分号而不是逗号。这使得语法更简单,也更容易理解。由于逗号语法,第一次插入需要 2 个登记。

    您用于批量插入的语法不正确。它非常简单,如下所示:

       q)   t:([id:`int$()] str:())  / create table
       q) `t insert (0;enlist "test")   / insert first row
       q)  `t insert (1 2;("test1";"test2"))  / bulk insert 2 rows
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-14
    相关资源
    最近更新 更多