java.lang.Object
com.microsoft.sqlserver.jdbc.SQLServerMetaData
Represents metadata for a column. It is used in the ISQLServerDataRecord interface to pass column metadata to the
table-valued parameter.
-
Constructor Summary
ConstructorDescriptionSQLServerMetaData
(SQLServerMetaData sqlServerMetaData) Constructs a SQLServerMetaData from another SQLServerMetaData object.SQLServerMetaData
(String columnName, int sqlType) Constructs a SQLServerMetaData with the column name and SQL type.SQLServerMetaData
(String columnName, int sqlType, int length) Constructs a SQLServerMetaData with the column name, SQL type, and length (for String data).SQLServerMetaData
(String columnName, int sqlType, int precision, int scale) Constructs a SQLServerMetaData with the column name, SQL type, precision, and scale.SQLServerMetaData
(String columnName, int sqlType, int precision, int scale, boolean useServerDefault, boolean isUniqueKey, com.microsoft.sqlserver.jdbc.SQLServerSortOrder sortOrder, int sortOrdinal) Constructs a SQLServerMetaData. -
Method Summary
Modifier and TypeMethodDescriptionReturns the column name.int
Returns the precision of the type passed to the column.int
getScale()
Returns the scale of the type passed to the column.com.microsoft.sqlserver.jdbc.SQLServerSortOrder
Returns the sort order.int
Returns the sort ordinal.int
Returns the java sql type.boolean
Returns whether the column is unique.boolean
Returns whether the column uses the default server value.
-
Constructor Details
-
SQLServerMetaData
Constructs a SQLServerMetaData with the column name and SQL type.- Parameters:
columnName
- the name of the columnsqlType
- the SQL type of the column
-
SQLServerMetaData
Constructs a SQLServerMetaData with the column name, SQL type, precision, and scale.- Parameters:
columnName
- the name of the columnsqlType
- the SQL type of the columnprecision
- the precision of the columnscale
- the scale of the column
-
SQLServerMetaData
Constructs a SQLServerMetaData with the column name, SQL type, and length (for String data). The length is used to differentiate large strings from strings with length less than 4000 characters.- Parameters:
columnName
- the name of the columnsqlType
- the SQL type of the columnlength
- the length of the string type
-
SQLServerMetaData
public SQLServerMetaData(String columnName, int sqlType, int precision, int scale, boolean useServerDefault, boolean isUniqueKey, com.microsoft.sqlserver.jdbc.SQLServerSortOrder sortOrder, int sortOrdinal) throws SQLServerException Constructs a SQLServerMetaData.- Parameters:
columnName
- the name of the columnsqlType
- the sql type of the columnprecision
- the precision of the columnscale
- the scale of the columnuseServerDefault
- specifies if this column should use the default server value; Default value is false.isUniqueKey
- indicates if the column in the table-valued parameter is unique; Default value is false.sortOrder
- indicates the sort order for a column; Default value is SQLServerSortOrder.Unspecified.sortOrdinal
- specifies ordinal of the sort column; sortOrdinal starts from 0; Default value is -1.- Throws:
SQLServerException
- when an error occurs
-
SQLServerMetaData
Constructs a SQLServerMetaData from another SQLServerMetaData object.- Parameters:
sqlServerMetaData
- the object passed to initialize a new instance of SQLServerMetaData
-
-
Method Details
-
getColumName
Returns the column name.- Returns:
- column name
-
getSqlType
public int getSqlType()Returns the java sql type.- Returns:
- java sql type
-
getPrecision
public int getPrecision()Returns the precision of the type passed to the column.- Returns:
- precision
-
getScale
public int getScale()Returns the scale of the type passed to the column.- Returns:
- scale
-
useServerDefault
public boolean useServerDefault()Returns whether the column uses the default server value.- Returns:
- whether the column uses the default server value.
-
isUniqueKey
public boolean isUniqueKey()Returns whether the column is unique.- Returns:
- whether the column is unique.
-
getSortOrder
public com.microsoft.sqlserver.jdbc.SQLServerSortOrder getSortOrder()Returns the sort order.- Returns:
- sort order
-
getSortOrdinal
public int getSortOrdinal()Returns the sort ordinal.- Returns:
- sort ordinal
-