title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic |
---|---|---|---|---|---|---|---|
Using result set metadata |
Using result set metadata |
David-Engel |
davidengel |
08/12/2019 |
sql |
connectivity |
conceptual |
[!INCLUDEDriver_JDBC_Download]
To query a result set for information about the columns that it contains, the [!INCLUDEjdbcNoVersion] implements the SQLServerResultSetMetaData class. This class contains numerous methods that return information in the form of a single value.
To create a SQLServerResultSetMetaData object, you can use the getMetaData method of the SQLServerResultSet class.
In the following example, an open connection to the [!INCLUDEssSampleDBnormal] sample database is passed in to the function, the getMetaData method of the SQLServerResultSet class is used to return a SQLServerResultSetMetaData object, and then various methods of the SQLServerResultSetMetaData object are used to display information about the name and data type of the columns contained within the result set.
[!codeJDBC#UsingResultSetMetaData1]