The ColumnMaxLength property exposes the maximum number of characters required to store the data of a column in the current result set of a QueryResults object.
object.ColumnMaxLength( OrdinalColumn )
| Part | Description |
|---|---|
| object | Expression that evaluates to an object in the Applies To list |
| OrdinalColumn | Long integer specifying the column in the results by position |
Interpret the value of the ColumnMaxLength property with respect to the data type of the column in the result set. Retrieve the data type by using the ColumnType property.
| ColumnType Property | ColumnMaxLength |
|---|---|
| SQLDMO_DTypeBinary, SQLDMO_DTypeNText, SQLDMO_DTypeText, SQLDMO_DTypeVarBinary, SQLDMO_DTypeGUID, or SQLDMO_DTypeImage | System-defined value. Use the GetColumnBinaryLength method to determine the length of a specified row value. |
| SQLDMO_DTypeBit, SQLDMO_DTypeInt1, SQLDMO_DTypeFloat8, SQLDMO_DTypeInt2, SQLDMO_DTypeInt4, SQLDMO_DTypeMoney, or SQLDMO_DTypeMoney4 | Maximum precision of a value of the type. |
| SQLDMO_DTypeChar, SQLDMO_DTypeVarchar, SQLDMO_DTypeUChar, or SQLDMO_DTypeUVarchar | Count of bytes required to represent the data as a Unicode character string (two bytes per character). Count incremented to include the count of bytes in a string terminator. |
| SQLDMO_DTypeDateTime or SQLDMO_DTypeDateTime4 | System defined value. |
String
Read-only
HRESULT GetColumnMaxLength(long nColumn, LPLONG pRetVal);