Module com.microsoft.sqlserver.jdbc
Package com.microsoft.sqlserver.jdbc

# Class SQLServerMetaData

java.lang.Object
com.microsoft.sqlserver.jdbc.SQLServerMetaData

public class SQLServerMetaData extends Object
Represents metadata for a column. It is used in the ISQLServerDataRecord interface to pass column metadata to the table-valued parameter.

## Constructor Summary

Constructors
Constructor
Description
`SQLServerMetaData​(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 Type
Method
Description
`String`
`getColumName()`
Returns the column name.
`int`
`getPrecision()`
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`
`getSortOrder()`
Returns the sort order.
`int`
`getSortOrdinal()`
Returns the sort ordinal.
`int`
`getSqlType()`
Returns the java sql type.
`boolean`
`isUniqueKey()`
Returns whether the column is unique.
`boolean`
`useServerDefault()`
Returns whether the column uses the default server value.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SQLServerMetaData

public SQLServerMetaData​(String columnName, int sqlType)
Constructs a SQLServerMetaData with the column name and SQL type.

Parameters:
  `columnName` - the name of the column
  `sqlType` - the SQL type of the column

### SQLServerMetaData

public SQLServerMetaData​(String columnName, int sqlType, int precision, int scale)
Constructs a SQLServerMetaData with the column name, SQL type, precision, and scale.

Parameters:
  `columnName` - the name of the column
  `sqlType` - the SQL type of the column
  `precision` - the precision of the column
  `scale` - the scale of the column

### SQLServerMetaData

public SQLServerMetaData​(String columnName, int sqlType, int length)
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 column
  `sqlType` - the SQL type of the column
  `length` - 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 column
  `sqlType` - the sql type of the column
  `precision` - the precision of the column
  `scale` - the scale of the column
  `useServerDefault` - 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

public SQLServerMetaData​(SQLServerMetaData sqlServerMetaData)
Constructs a SQLServerMetaData from another SQLServerMetaData object.

Parameters:
  `sqlServerMetaData` - the object passed to initialize a new instance of SQLServerMetaData

## Method Details

### getColumName

public String 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