This documentation is archived and is not being maintained.
SqlMetaData Class
Visual Studio 2010
Specifies and retrieves metadata information from parameters and columns of SqlDataRecord objects. This class cannot be inherited.
Assembly: System.Data (in System.Data.dll)
The SqlMetaData type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | SqlMetaData(String, SqlDbType) | Initializes a new instance of the SqlMetaData class with the specified column name and type. |
![]() | SqlMetaData(String, SqlDbType, Int64) | Initializes a new instance of the SqlMetaData class with the specified column name, type, and maximum length. |
![]() | SqlMetaData(String, SqlDbType, Type) | Initializes a new instance of the SqlMetaData class with the specified column name, type, and user-defined type (UDT). |
![]() | SqlMetaData(String, SqlDbType, Byte, Byte) | Initializes a new instance of the SqlMetaData class with the specified column name, type, precision, and scale. |
![]() | SqlMetaData(String, SqlDbType, Type, String) | Initializes a new instance of the SqlMetaData class with the specified column name, user-defined type (UDT), and SQLServer type. |
![]() | SqlMetaData(String, SqlDbType, Int64, Int64, SqlCompareOptions) | Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, locale, and compare options. |
![]() | SqlMetaData(String, SqlDbType, String, String, String) | Initializes a new instance of the SqlMetaData class with the specified column name, type, database name, owning schema, and object name. |
![]() | SqlMetaData(String, SqlDbType, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, and default server. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, Int64, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, Byte, Byte, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, type, precision, scale, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, Int64, Byte, Byte, Int64, SqlCompareOptions, Type) | Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, precision, scale, locale ID, compare options, and user-defined type (UDT). |
![]() | SqlMetaData(String, SqlDbType, Type, String, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, type, user-defined type, SQL Server type, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, Int64, Int64, SqlCompareOptions, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, locale, compare options, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, String, String, String, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, database name, owning schema, object name, and default server. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
![]() | SqlMetaData(String, SqlDbType, Int64, Byte, Byte, Int64, SqlCompareOptions, Type, Boolean, Boolean, SortOrder, Int32) | Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, precision, scale, locale ID, compare options, and user-defined type (UDT). This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column. |
| Name | Description | |
|---|---|---|
![]() | CompareOptions | Gets the comparison rules used for the column or parameter. |
![]() | DbType | Gets the data type of the column or parameter. |
![]() | IsUniqueKey | Indicates if the column in the table-valued parameter is unique. |
![]() | LocaleId | Gets the locale ID of the column or parameter. |
![]() ![]() | Max | Gets the length of text, ntext, and image data types. |
![]() | MaxLength | Gets the maximum length of the column or parameter. |
![]() | Name | Gets the name of the column or parameter. |
![]() | Precision | Gets the precision of the column or parameter. |
![]() | Scale | Gets the scale of the column or parameter. |
![]() | SortOrder | Returns the sort order for a column. |
![]() | SortOrdinal | Returns the ordinal of the sort column. |
![]() | SqlDbType | Gets the data type of the column or parameter. |
![]() | Type | Gets the common language runtime (CLR) type of a user-defined type (UDT). |
![]() | TypeName | Gets the three-part name of the user-defined type (UDT) or the SQL Server type represented by the instance. |
![]() | UseServerDefault | Reports whether this column should use the default server value. |
![]() | XmlSchemaCollectionDatabase | Gets the name of the database where the schema collection for this XML instance is located. |
![]() | XmlSchemaCollectionName | Gets the name of the schema collection for this XML instance. |
![]() | XmlSchemaCollectionOwningSchema | Gets the owning relational schema where the schema collection for this XML instance is located. |
| Name | Description | |
|---|---|---|
![]() | Adjust(Boolean) | Validates the specified Boolean value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Byte) | Validates the specified Byte value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(array<Byte>) | Validates the specified array of Byte values against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Char) | Validates the specified Char value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(array<Char>) | Validates the specified array of Char values against the metadata, and adjusts the value if necessary. |
![]() | Adjust(DateTime) | Validates the specified DateTime value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(DateTimeOffset) | Validates the specified DateTimeOffset value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Decimal) | Validates the specified Decimal value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Double) | Validates the specified Double value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Guid) | Validates the specified Guid value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Int16) | Validates the specified Int16 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Int32) | Validates the specified Int32 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Int64) | Validates the specified Int64 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Object) | Validates the specified Object value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(Single) | Validates the specified Single value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlBinary) | Validates the specified SqlBinary value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlBoolean) | Validates the specified SqlBoolean value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlByte) | Validates the specified SqlByte value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlBytes) | Validates the specified SqlBytes value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlChars) | Validates the specified SqlChars value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlDateTime) | Validates the specified SqlDateTime value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlDecimal) | Validates the specified SqlDecimal value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlDouble) | Validates the specified SqlDouble value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlGuid) | Validates the specified SqlGuid value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlInt16) | Validates the specified SqlInt16 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlInt32) | Validates the specified SqlInt32 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlInt64) | Validates the specified SqlInt64 value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlMoney) | Validates the specified SqlMoney value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlSingle) | Validates the specified SqlSingle value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlString) | Validates the specified SqlString value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(SqlXml) | Validates the specified SqlXml value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(String) | Validates the specified String value against the metadata, and adjusts the value if necessary. |
![]() | Adjust(TimeSpan) | Validates the specified TimeSpan value against the metadata, and adjusts the value if necessary. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | InferFromValue | Infers the metadata from the specified object and returns it as a SqlMetaData instance. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The following example shows the creation of several SqlMetaData objects, which describe the column metadata of a record, and the creation of a SqlDataRecord. The column values of the SqlDataRecord are set and the SqlDataRecord is sent to the calling program using the SqlContext class.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:



