Parameter | Description |
---|---|
sLogin | Login string |
Returns number of tables enumerated.
Function EnumerateTables String sLogin Returns Integer
Call: | Get EnumerateTables sLogin to IntegerVariable |
Enumerates tables in the given database. It builds an internal array containing the table name, schema for the table, table type and table comment. It returns the number of tables.
If we want to show all tables in a Microsoft SQL Server database and for every table all column names, we would program:
Procedure ShowAllTablesAndColumns String sDriver String sLogin Handle hoCLIHandler Integer iNumTables Integer iNumColumns Integer iTableCount Integer iColumnCount Get Create U_cCLIHandler To hoCLIhandler If (hoCLIHandler > 0) Begin Set psDriverID Of hoCLIHandler To sDriver Get EnumerateTables Of hoCLIHandler sLogin To iNumTables For iTableCount From 1 To iNumTables Show (TableName(hoCLIHandler, iTableCount)) "; " Show (SchemaName(hoCLIHandler, iTableCount)) "; " Show (TableType(hoCLIHandler, iTableCount)) "; " Showln (TableComment(hoCLIHandler, iTableCount)) Get EnumerateColumns Of hoCLIHandler sLogin ; (TableName(hoCLIHandler, iTableCount)) To iNumColumns For iColumnCount From 1 To iNumColumns Showln " " (ColumnName(hoCLIHandler, iColumnCount)) Loop Showln Loop Send Destroy Of hoCLIHandler End End_Procedure // ShowAllTablesAndColumns
If you want to use the above procedure for database D on server X with user account Y and password Z it would be called in the following way:
Send ShowAllTablesAndColumns MSSQLDRV_ID ; "DRIVER={SQL Server};SERVER=X;UID=Y;PWD=Z;DATABASE=D"