2017-08-14 34 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" 
相關問題