getTableTypes Method (SQLServerDatabaseMetaData)
Retrieves the table types that are available in the current database.
Syntax
public java.sql.ResultSet getTableTypes()
Return Value
A SQLServerResultSet object.
Exceptions
Remarks
This getTableTypes method is specified by the getTableTypes method in the java.sql.DatabaseMetaData interface.
The result set returned by the getTableTypes method will contain the following information:
Name | Type | Description |
---|---|---|
TABLE_TYPE | String | The table type. |
Note
For more information about the data returned by the getTableTypes method, see "sp_tables (Transact-SQL)" in SQL Server Books Online.
Example
The following example demonstrates how to use the getTableTypes method to return the table type information in the AdventureWorks2022 sample database, given that the database is specified in the connection String.
public static void executeGetTableTypes(Connection con) {
try {
DatabaseMetaData dbmd = con.getMetaData();
ResultSet rs = dbmd.getTableTypes();
ResultSetMetaData rsmd = rs.getMetaData();
// Display the result set data.
int cols = rsmd.getColumnCount();
while(rs.next()) {
for (int i = 1; i <= cols; i++) {
System.out.println(rs.getString(i));
}
}
rs.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
See Also
SQLServerDatabaseMetaData Methods
SQLServerDatabaseMetaData Members
SQLServerDatabaseMetaData Class