rowscopy, 拷贝带有自增字段的表

1.清除本地数据

ls_sql1 = "TRUNCATE TABLE" + ls_table [1]
execute IMMEDIATE :ls_sql1 using sqlca;

2.//打开可以插入自增,显示插入自增字段的值
ls_sql1 = "SET IDENTITY_INSERT " + ls_table [1] + " on"
execute IMMEDIATE :ls_sql1 using sqlca;

3.构造数据窗口,或datastore

4.wf_set_iden_off_1(dw_1) //关掉本地datastore的自增

wf_set_iden_off_1内容:

//将指定datastore 的自增字段设置为 off

string ls_colcount
long ll_colcount, i
string ls_ColName

ls_colcount = ar_ds.Describe("DataWindow.Column.Count")

if integer (ls_colcount) > 0 then
ll_colcount = integer (ls_colcount)
else
return
end if

string ls_on, ls_err

for i = 1 to ll_colcount
ls_ColName = ar_ds.Describe("#" + string(i) +".name")
ls_on = ar_ds.Describe("#" + string(i) +".Identity")
if ls_on = 'yes' then
ar_ds.modify (ls_ColName + ".Identity = 'no'" )
end if
next

5.开始copy,

6.update

结束

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus