2017-08-14 69 views

回答

1

您可以使用delete功能表(见here):

/ create some tables 
q)`a_one`a_two`b_one`b_two set\:([] x:til 10) 
    `a_one`a_two`b_one`b_two 
q)tables[] 
    `s#`a_one`a_two`b_one`b_two 

/find table names matching "a_*" and delete them from root namespace 
q)![`.;();0b;{x where x like "a_*"} tables[]] 
    `. 
q)tables[] 
    `s#`b_one`b_two 
1

如果你经常需要这个功能,我建议你定义一个drop功能如下:

q)drop:![`.;();0b;](), 

此功能将采用一个或多个表名作为符号并删除它们。它可用于通过模式

q)drop{x where x like"prefix_*_suffix"}tables[] 

删除一个选择器功能相结合,您还可以定义一个函数drop_matching

q)drop_matching:drop{a where(a:tables[])like x}@ 

,将一举做的工作:

q)drop_matching"prefix_*_suffix" 
相关问题