Package microsoft.sql

Class Types


  • public final class Types
    extends Object
    Defines the constants that are used to identify SQL types specific to Microsoft SQL Server. These type codes are used internally by the JDBC driver for type identification and do not correspond to the native SQL Server data type values. The driver uses these constants when reporting column types through ParameterMetaData and ResultSetMetaData interfaces. To retrieve the actual SQL Server native data type codes, use DatabaseMetaData.getColumns() and read the SQL_DATA_TYPE column from the result set. For example: ResultSet rs = metaData.getColumns(null, null, tableName, "%"); int sqlDataType = rs.getInt("SQL_DATA_TYPE"); The SQL_DATA_TYPE column contains the native SQL Server type codes as returned by the sp_columns stored procedure (sp_columns_170 on SQL Server 2025+, sp_columns_100 on older versions). This class is never instantiated.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DATETIME
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type DATETIME.
      static int DATETIMEOFFSET
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type DATETIMEOFFSET.
      static int GEOGRAPHY
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GEOGRAPHY.
      static int GEOMETRY
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GEOMETRY.
      static int GUID
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GUID.
      static int JSON
      Microsoft SQL type JSON.
      static int MONEY
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type MONEY.
      static int SMALLDATETIME
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SMALLDATETIME.
      static int SMALLMONEY
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SMALLMONEY.
      static int SQL_VARIANT
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SQL_VARIANT.
      static int STRUCTURED
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type STRUCTURED.
      static int VECTOR
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type VECTOR.
    • Field Detail

      • DATETIMEOFFSET

        public static final int DATETIMEOFFSET
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type DATETIMEOFFSET.
        See Also:
        Constant Field Values
      • STRUCTURED

        public static final int STRUCTURED
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type STRUCTURED.
        See Also:
        Constant Field Values
      • DATETIME

        public static final int DATETIME
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type DATETIME.
        See Also:
        Constant Field Values
      • SMALLDATETIME

        public static final int SMALLDATETIME
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SMALLDATETIME.
        See Also:
        Constant Field Values
      • MONEY

        public static final int MONEY
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type MONEY.
        See Also:
        Constant Field Values
      • SMALLMONEY

        public static final int SMALLMONEY
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SMALLMONEY.
        See Also:
        Constant Field Values
      • GUID

        public static final int GUID
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GUID.
        See Also:
        Constant Field Values
      • SQL_VARIANT

        public static final int SQL_VARIANT
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type SQL_VARIANT.
        See Also:
        Constant Field Values
      • GEOMETRY

        public static final int GEOMETRY
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GEOMETRY.
        See Also:
        Constant Field Values
      • GEOGRAPHY

        public static final int GEOGRAPHY
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type GEOGRAPHY.
        See Also:
        Constant Field Values
      • VECTOR

        public static final int VECTOR
        The constant in the Java programming language, sometimes referred to as a type code, that identifies the Microsoft SQL type VECTOR.
        See Also:
        Constant Field Values