June 27, 2003

Loop thru all the Tables in a database Without Knowing the Names


1:     loop thru all the tables in a database without knowing the names." 

2:
3:
4: dim oConn, oRSTbl
5:
6: '
7: ' Open the object that we'll need.
8: '
9: set oConn = CreateObject ("ADODB.Connection")
10: set oRSTbl = CreateObject ("ADODB.Recordset")
11: oConn.open "DSN=MyDSN;
12:
13: '
14: ' Pass 20 to the function for Tables.
15: '
16: set oRSTbl = oConn.OpenSchema (20)
17:
18: '
19: ' Fly down our schema and generate a message
20: ' for each table we find
21: '
22: while not oRSTbl.eof
23: MsgBox "Table is [" + oRSTbl ("TABLE_NAME") + "]"
24: oRSTbl.movenext
25: wend
26:
27:


Posted by sachauncey at June 27, 2003 06:41 PM