Tuesday, August 4, 2009

Script to load all the tables from the active ODBC connection

ODBC CONNECT TO [datasource name];

Test:
SQLTables;

Test1:
Load * ,'' as dummy
Resident Test where TABLE_TYPE='TABLE';

Drop table Test;
Drop Field dummy;

Let tableName='';
FOR i = 0 to NoOfRows('Test1')-1
LET tableName = tableName & chr(39) & peek('TABLE_NAME', i, 'Test1') & chr(39);

If $(i)< NoOfRows('Test1')-1 Then
Let tableName = tableName & ',';
End If
Next

For each table in $(tableName)
[$(table)]:
Load *;
Sql Select * from [$(table)];
Next

No comments:

Post a Comment