如何更改 KDb+ 中的数据类型?

How to change data type in KDb+?

我在 KDb+ 中创建了 table 如下:

test:([doc_id:`symbol$()];doc_displayid:`symbol$();doc_created_date:`date$();doc_aacess_date:`timestamp$();is_native_exist:`boolean$();file_size:`real$())

现在我想将列 doc_id 的数据类型从 symbol 更改为 int.

如何更改测试 table 并更改 数据类型

您需要先将列转换为字符串,然后才能将其转换为 int:

q)update "I"$string doc_id from test
doc_id| doc_displayid doc_created_date doc_aacess_date is_native_exist file_s..
------| ---------------------------------------------------------------------..

您可以使用 meta 验证新类型:

q)meta update "I"$string doc_id from test
c               | t f a
----------------| -----
doc_id          | i
doc_displayid   | s
doc_created_date| d
doc_aacess_date | p
is_native_exist | b
file_size       | e