在Powerdesigner中,根据已有字段的Name值替换Code相同的Name的值

如果在powerdesigner中有一个表我已经把名子和你码对应好了.
比如Name是年,Code是year,那么怎么把别的表中的Code是Year的Name设成年呢?
用以下代码即可,哈哈.调好了.

Dim nb
nb=ActiveSelection.Count
if nb=0 then
Output "No selected Objects"
end if
dim obj
Dim d                   '创建一个变量  and (not d.Exists(col.Code))
Set d = CreateObject("Scripting.Dictionary")
for Each obj in ActiveSelection
  for each col in obj.Columns
    if (col.Code<>col.Name) and (not d.Exists(col.Code))then
    Output "--"+obj.Name+"."+obj.Code+"="+col.Name+"."+col.Code
      d.Add col.Code,col.Name
     end if
  next
next
for Each obj in ActiveSelection
  for each col in obj.Columns 
    if (col.Code=col.Name) and (d.Exists(col.Code) )then
     Output col.Name+"."+col.Code+"."+d.Item(col.Code)
      col.Name=d.Item(col.Code)
     end if
  next
next
posted @ 2008-09-04 14:14  kingkoo  阅读(1623)  评论(0编辑  收藏  举报