Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find all tables with a field
Message
From
10/03/2004 13:50:50
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/03/2004 12:59:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00884904
Message ID:
00884925
Views:
10
>VFP 7 (8 latter)
>
>I am updating an application and I need to be sure I added a field to all the tables that need it. Is there a simple way to get a list of:
>
>1. all tables that contain a field.
>
>2. a list of fields and tables they are in sorted by field and table.
lcField = 'MyFieldNameToCheck'
lcDataPath = getdir()
lnTables = adir(aTables, addbs(m.lcDataPath)+'*.dbf')
for ix=1 to m.lnTables
  use (addbs(m.lcDataPath)+aTables[m.ix,1])
  if fsize(m.lcField) = 0
     ? 'Missing in :', dbf()
  endif
  use
endfor
lcDataPath = getdir()
lnTables = adir(aTables, addbs(m.lcDataPath)+'*.dbf')
use (addbs(m.lcDataPath)+aTables[1,1])
copy struc extended to myLister
use myLister
m.Table_Name = aTables[1,1]
replace all table_name with m.Table_name 
for ix=2 to m.lnTables
  Select 0
  use (addbs(m.lcDataPath)+aTables[m.ix,1])
  copy stru extended to _temp_
  use
  Select myLister
  m.rec = reccount('myLister')
  append from _temp_
  go m.rec+1
  m.Table_Name = aTables[m.ix,1]
  replace rest table_name with m.Table_name
EndFor
Erase '_temp_.dbf'
browse
PS: You might also compare data folders (old and new) with Foxyclasses DataDelta utility.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform