如何遍历 AOT 名称中包含特定字符的表并删除数据? [英] How can I loop over Tables which contain specific characters in their AOT name and delete the data?
本文介绍了如何遍历 AOT 名称中包含特定字符的表并删除数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想遍历一些名称(aotName)以HbcCka"开头的表,最后我想从表中删除所有数据.
I want to loop over a few tables where the name (aotName) begins with 'HbcCka', finally I want to delete all data from the tables.
现在我需要一个逻辑来清空表格.我怎样才能做到这一点?
Now I need a logic to empty the tables. How can I achieve this?
更新:
static void tstDeleteForecastingData(Args _args)
{
Dictionary dictionary = new Dictionary();
int i;
SysDictTable dictTable;
;
for (i=1 ; i<=dictionary.tableCnt() ; i++)
{
if (strScan(tableid2name(dictionary.tableCnt2Id(i)), "HbcCka", 1, strLen(dictionary.tableName(i))))
{
info(strfmt('%1;%2', dictionary.tableCnt2Id(i), tableid2name( dictionary.tableCnt2Id(i) )));
}
}
}
推荐答案
截断所有公司的表格?
使用 System Administration\Periodic\Databases\SQL Administration,标记表,然后选择 Table actions\Truncate.
Use System Administration\Periodic\Databases\SQL Administration, mark the tables then choose Table actions\Truncate.
或者用服务器的main方法创建一个类:
Or make a class with a server main method:
ClassDeclaration tstDeleteForecastingData
{
}
static server void main(Args _args)
{
Dictionary dictionary = new Dictionary();
int i;
for (i=1 ; i<=dictionary.tableCnt() ; i++)
{
if (strScan(tableid2name(dictionary.tableCnt2Id(i)), "HbcCka", 1, 99)))
{
info(strfmt('%1;%2', dictionary.tableCnt2Id(i), tableid2name( dictionary.tableCnt2Id(i) )));
new SqlDataDictionaryPermission(methodstr(SqlDataDictionary, tableTruncate)).assert();
new SqlDataDictionary().tableTruncate(dictionary.tableCnt2Id(i), false);
CodeAccessPermission::revertAssert();
}
}
}
如果仅在当前公司:
Common table = new DictTable(<tableId>).makeRecord();
table.skipDeleteMethod(true);
table.skipDeleteAction(true);
delete_from table;
这篇关于如何遍历 AOT 名称中包含特定字符的表并删除数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文