Difference between revisions of "SQLTABLES()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Helen.george (Talk | contribs) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]] | + | [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTRANSACTION()]] |
==Description== | ==Description== | ||
Line 13: | Line 13: | ||
The SQLTABLES() function operates on the data source specified by <nStatementHandle>. | The SQLTABLES() function operates on the data source specified by <nStatementHandle>. | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
− | !width=30%|Keywords||width=70%|Description | + | !width="30%"|Keywords||width="70%"|Description |
|- | |- | ||
− | |nStatementHandle|| | + | |nStatementHandle||Statement handle to the connection |
|- | |- | ||
|valign="top"|cTableType||The table type or types to include. ’TABLE’, ’VIEW’ and ’SYSTEM_TABLE’ are all valid table types. If cTableType is omitted or empty, all types of table are included | |valign="top"|cTableType||The table type or types to include. ’TABLE’, ’VIEW’ and ’SYSTEM_TABLE’ are all valid table types. If cTableType is omitted or empty, all types of table are included | ||
Line 26: | Line 26: | ||
cCursorName Table Columns: | cCursorName Table Columns: | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
− | !width=30%|Column||width=70%|Description | + | !width="30%"|Column||width="70%"|Description |
|- | |- | ||
|TABLE_QUALIFIER||Table qualifier id | |TABLE_QUALIFIER||Table qualifier id | ||
Line 43: | Line 43: | ||
====Return values:==== | ====Return values:==== | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
− | !width=30%|Return Value||width=70%|Description | + | !width="30%"|Return Value||width="70%"|Description |
|- | |- | ||
|1||The cursor was created successfully | |1||The cursor was created successfully | ||
Line 58: | Line 58: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | nStatHand= | + | nStatHand = sqlstringconnect("awhr2") |
if nStatHand < 1 | if nStatHand < 1 | ||
messagebox("Could not connect") | messagebox("Could not connect") | ||
else | else | ||
// Store names for all table types to default results table | // Store names for all table types to default results table | ||
− | nTabEnd = | + | nTabEnd = sqltables(nStatHand) |
if nTabEnd = 1 | if nTabEnd = 1 | ||
select sqlresult | select sqlresult | ||
Line 70: | Line 70: | ||
endif | endif | ||
− | nStatHand= | + | nStatHand = sqlstringconnect("Driver={SQL Server};Server=USER-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;") |
if nStatHand < 1 | if nStatHand < 1 | ||
messagebox("Could not connect") | messagebox("Could not connect") | ||
else | else | ||
// Store names for specified table types to specified results table | // Store names for specified table types to specified results table | ||
− | nTabEnd = | + | nTabEnd = sqltables(nStatHand, "'TABLE','VIEW'", "myresults") |
if nTabEnd = 1 | if nTabEnd = 1 | ||
select myresults | select myresults | ||
Line 86: | Line 86: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
− | |||
[[Category:ODBC Functions]] | [[Category:ODBC Functions]] | ||
[[Category:SQL Functions]] | [[Category:SQL Functions]] |
Latest revision as of 10:02, 4 February 2013
Purpose
Store data source table names to a table
Syntax
SQLTABLES(<nStatementHandle>[, <cTableTypes>] [, <cCursorName>])
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTRANSACTION()
Description
The SQLTABLES() function is used to store table name information for a specified connection to a table.
The SQLTABLES() function operates on the data source specified by <nStatementHandle>.
Keywords | Description |
---|---|
nStatementHandle | Statement handle to the connection |
cTableType | The table type or types to include. ’TABLE’, ’VIEW’ and ’SYSTEM_TABLE’ are all valid table types. If cTableType is omitted or empty, all types of table are included |
cCursorName | The name of the table to create. If cCursorName is not specified, the default name SQLRESULT is used. The table column information is shown in the table below |
cCursorName Table Columns:
Column | Description |
---|---|
TABLE_QUALIFIER | Table qualifier id |
TABLE_OWNER | Table owner id |
TABLE_NAME | Table name |
TABLE_TYPE | Table type |
REMARKS | Table description |
Return values:
Return Value | Description |
---|---|
1 | The cursor was created successfully |
0 | SQLTABLES() still executing |
Example
nStatHand = sqlstringconnect("awhr2") if nStatHand < 1 messagebox("Could not connect") else // Store names for all table types to default results table nTabEnd = sqltables(nStatHand) if nTabEnd = 1 select sqlresult list endif endif nStatHand = sqlstringconnect("Driver={SQL Server};Server=USER-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;") if nStatHand < 1 messagebox("Could not connect") else // Store names for specified table types to specified results table nTabEnd = sqltables(nStatHand, "'TABLE','VIEW'", "myresults") if nTabEnd = 1 select myresults list endif endif