分享

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

 dongsibei 2014-07-02

  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
  
  结束

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约