SqlDecimal SqlDecimal SqlDecimal SqlDecimal Struct

Definition

Represents a numeric value between - 10^38 +1 and 10^38 - 1, with fixed precision and scale.

public value class SqlDecimal : IComparable, System::Data::SqlTypes::INullable, System::Xml::Serialization::IXmlSerializable
[Serializable]
public struct SqlDecimal : IComparable, System.Data.SqlTypes.INullable, System.Xml.Serialization.IXmlSerializable
type SqlDecimal = struct
    interface INullable
    interface IXmlSerializable
Public Structure SqlDecimal
Implements IComparable, INullable, IXmlSerializable
Inheritance
SqlDecimalSqlDecimalSqlDecimalSqlDecimal
Attributes
SerializableAttribute
Implements

Remarks

SqlDecimal has different underlying data structures from its corresponding .NET Framework Decimal data type. Decimal has no concept of precision. It uses 3 bytes to store the actual data, and therefore has a maximum scale of 28. The data range is -79,228,162,514,264,337,593,543,950,335 through 79,228,162,514,264,337,593,543,950,335. SqlDecimal has both precision and scale. It uses 4 unsigned 4-byte integers to store the actual data, and therefore has maximum precision and scale of 38. The data range is - 10^38 +1 through 10^38 - 1.

Constructors

SqlDecimal(Decimal) SqlDecimal(Decimal) SqlDecimal(Decimal) SqlDecimal(Decimal)

Initializes a new instance of the SqlDecimal structure using the supplied Decimal value.

SqlDecimal(Double) SqlDecimal(Double) SqlDecimal(Double) SqlDecimal(Double)

Initializes a new instance of the SqlDecimal structure using the supplied double parameter.

SqlDecimal(Int32) SqlDecimal(Int32) SqlDecimal(Int32) SqlDecimal(Int32)

Initializes a new instance of the SqlDecimal structure using the supplied integer value.

SqlDecimal(Int64) SqlDecimal(Int64) SqlDecimal(Int64) SqlDecimal(Int64)

Initializes a new instance of the SqlDecimal structure using the supplied long integer value.

SqlDecimal(Byte, Byte, Boolean, Int32[]) SqlDecimal(Byte, Byte, Boolean, Int32[]) SqlDecimal(Byte, Byte, Boolean, Int32[]) SqlDecimal(Byte, Byte, Boolean, Int32[])

Initializes a new instance of the SqlDecimal structure using the supplied parameters.

SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32) SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32) SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32) SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32)

Initializes a new instance of the SqlDecimal structure using the supplied parameters.

Fields

MaxPrecision MaxPrecision MaxPrecision MaxPrecision

A constant representing the largest possible value for the Precision property.

MaxScale MaxScale MaxScale MaxScale

A constant representing the maximum value for the Scale property.

MaxValue MaxValue MaxValue MaxValue

A constant representing the maximum value of a SqlDecimal structure.

MinValue MinValue MinValue MinValue

A constant representing the minimum value for a SqlDecimal structure.

Null Null Null Null

Represents a DBNull that can be assigned to this instance of the SqlDecimal class.

Properties

BinData BinData BinData BinData

Get the binary representation of the value of this SqlDecimal structure as an array of bytes.

Data Data Data Data

Gets the binary representation of this SqlDecimal structure as an array of integers.

IsNull IsNull IsNull IsNull

Indicates whether this SqlDecimal structure is null.

IsPositive IsPositive IsPositive IsPositive

Indicates whether the Value of this SqlDecimal structure is greater than zero.

Precision Precision Precision Precision

Gets the maximum number of digits used to represent the Value property.

Scale Scale Scale Scale

Gets the number of decimal places to which Value is resolved.

Value Value Value Value

Gets the value of the SqlDecimal structure. This property is read-only.

Methods

Abs(SqlDecimal) Abs(SqlDecimal) Abs(SqlDecimal) Abs(SqlDecimal)

The Abs method gets the absolute value of the SqlDecimal parameter.

Add(SqlDecimal, SqlDecimal) Add(SqlDecimal, SqlDecimal) Add(SqlDecimal, SqlDecimal) Add(SqlDecimal, SqlDecimal)

Calculates the sum of the two SqlDecimal operators.

AdjustScale(SqlDecimal, Int32, Boolean) AdjustScale(SqlDecimal, Int32, Boolean) AdjustScale(SqlDecimal, Int32, Boolean) AdjustScale(SqlDecimal, Int32, Boolean)

The scale of the SqlDecimal operand will be adjusted to the number of digits indicated by the digits parameter. Depending on the value of the fRound parameter, the value will either be rounded to the appropriate number of digits or truncated.

Ceiling(SqlDecimal) Ceiling(SqlDecimal) Ceiling(SqlDecimal) Ceiling(SqlDecimal)

Returns the smallest whole number greater than or equal to the specified SqlDecimal structure.

CompareTo(SqlDecimal) CompareTo(SqlDecimal) CompareTo(SqlDecimal) CompareTo(SqlDecimal)

Compares this SqlDecimal instance to the supplied SqlDecimal object and returns an indication of their relative values.

CompareTo(Object) CompareTo(Object) CompareTo(Object) CompareTo(Object)

Compares this SqlDecimal instance to the supplied Object and returns an indication of their relative values.

ConvertToPrecScale(SqlDecimal, Int32, Int32) ConvertToPrecScale(SqlDecimal, Int32, Int32) ConvertToPrecScale(SqlDecimal, Int32, Int32) ConvertToPrecScale(SqlDecimal, Int32, Int32)

Adjusts the value of the SqlDecimal operand to the indicated precision and scale.

Divide(SqlDecimal, SqlDecimal) Divide(SqlDecimal, SqlDecimal) Divide(SqlDecimal, SqlDecimal) Divide(SqlDecimal, SqlDecimal)

The division operator calculates the results of dividing the first SqlDecimal operand by the second.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Compares the supplied Object parameter to the Value property of the SqlDecimal instance.

Equals(SqlDecimal, SqlDecimal) Equals(SqlDecimal, SqlDecimal) Equals(SqlDecimal, SqlDecimal) Equals(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.

Floor(SqlDecimal) Floor(SqlDecimal) Floor(SqlDecimal) Floor(SqlDecimal)

Rounds a specified SqlDecimal number to the next lower whole number.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns the hash code for this instance.

GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet)

Returns the XML Schema definition language (XSD) of the specified XmlSchemaSet.

GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.

LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.

LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.

Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal)

The multiplication operator computes the product of the two SqlDecimal parameters.

NotEquals(SqlDecimal, SqlDecimal) NotEquals(SqlDecimal, SqlDecimal) NotEquals(SqlDecimal, SqlDecimal) NotEquals(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.

Parse(String) Parse(String) Parse(String) Parse(String)

Converts the String representation of a number to its SqlDecimal equivalent.

Power(SqlDecimal, Double) Power(SqlDecimal, Double) Power(SqlDecimal, Double) Power(SqlDecimal, Double)

Raises the value of the specified SqlDecimal structure to the specified exponential power.

Round(SqlDecimal, Int32) Round(SqlDecimal, Int32) Round(SqlDecimal, Int32) Round(SqlDecimal, Int32)

Gets the number nearest the specified SqlDecimal structure's value with the specified precision.

Sign(SqlDecimal) Sign(SqlDecimal) Sign(SqlDecimal) Sign(SqlDecimal)

Gets a value that indicates the sign of a SqlDecimal structure's Value property.

Subtract(SqlDecimal, SqlDecimal) Subtract(SqlDecimal, SqlDecimal) Subtract(SqlDecimal, SqlDecimal) Subtract(SqlDecimal, SqlDecimal)

Calculates the results of subtracting the second SqlDecimal operand from the first.

ToDouble() ToDouble() ToDouble() ToDouble()

Returns the a double equal to the contents of the Value property of this instance.

ToSqlBoolean() ToSqlBoolean() ToSqlBoolean() ToSqlBoolean()

Converts this SqlDecimal structure to SqlBoolean.

ToSqlByte() ToSqlByte() ToSqlByte() ToSqlByte()

Converts this SqlDecimal structure to SqlByte.

ToSqlDouble() ToSqlDouble() ToSqlDouble() ToSqlDouble()

Converts this SqlDecimal structure to SqlDouble.

ToSqlInt16() ToSqlInt16() ToSqlInt16() ToSqlInt16()

Converts this SqlDecimal structure to SqlInt16.

ToSqlInt32() ToSqlInt32() ToSqlInt32() ToSqlInt32()

Converts this SqlDecimal structure to SqlInt32.

ToSqlInt64() ToSqlInt64() ToSqlInt64() ToSqlInt64()

Converts this SqlDecimal structure to SqlInt64.

ToSqlMoney() ToSqlMoney() ToSqlMoney() ToSqlMoney()

Converts this SqlDecimal structure to SqlMoney.

ToSqlSingle() ToSqlSingle() ToSqlSingle() ToSqlSingle()

Converts this SqlDecimal structure to SqlSingle.

ToSqlString() ToSqlString() ToSqlString() ToSqlString()

Converts this SqlDecimal structure to SqlString.

ToString() ToString() ToString() ToString()

Converts this SqlDecimal structure to String.

Truncate(SqlDecimal, Int32) Truncate(SqlDecimal, Int32) Truncate(SqlDecimal, Int32) Truncate(SqlDecimal, Int32)

Truncates the specified SqlDecimal structure's value to the that you want position.

Operators

Addition(SqlDecimal, SqlDecimal) Addition(SqlDecimal, SqlDecimal) Addition(SqlDecimal, SqlDecimal) Addition(SqlDecimal, SqlDecimal)

Calculates the sum of the two SqlDecimal operators.

Division(SqlDecimal, SqlDecimal) Division(SqlDecimal, SqlDecimal) Division(SqlDecimal, SqlDecimal) Division(SqlDecimal, SqlDecimal)

The division operator calculates the results of dividing the first SqlDecimal operand by the second.

Equality(SqlDecimal, SqlDecimal) Equality(SqlDecimal, SqlDecimal) Equality(SqlDecimal, SqlDecimal) Equality(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.

Explicit(Double to SqlDecimal) Explicit(Double to SqlDecimal) Explicit(Double to SqlDecimal) Explicit(Double to SqlDecimal)

Converts the Double parameter to SqlDecimal.

Explicit(SqlString to SqlDecimal) Explicit(SqlString to SqlDecimal) Explicit(SqlString to SqlDecimal) Explicit(SqlString to SqlDecimal)

Converts the supplied SqlString parameter to SqlDecimal.

Explicit(SqlSingle to SqlDecimal) Explicit(SqlSingle to SqlDecimal) Explicit(SqlSingle to SqlDecimal) Explicit(SqlSingle to SqlDecimal)

Converts the supplied SqlSingle structure to SqlDecimal.

Explicit(SqlDecimal to Decimal) Explicit(SqlDecimal to Decimal) Explicit(SqlDecimal to Decimal) Explicit(SqlDecimal to Decimal)

Converts the SqlDecimal parameter to Decimal.

Explicit(SqlBoolean to SqlDecimal) Explicit(SqlBoolean to SqlDecimal) Explicit(SqlBoolean to SqlDecimal) Explicit(SqlBoolean to SqlDecimal)

Converts the supplied SqlBoolean structure to SqlDecimal.

Explicit(SqlDouble to SqlDecimal) Explicit(SqlDouble to SqlDecimal) Explicit(SqlDouble to SqlDecimal) Explicit(SqlDouble to SqlDecimal)

Converts the supplied SqlDouble structure to SqlDecimal.

GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal) GreaterThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal) GreaterThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.

Implicit(SqlMoney to SqlDecimal) Implicit(SqlMoney to SqlDecimal) Implicit(SqlMoney to SqlDecimal) Implicit(SqlMoney to SqlDecimal)

Converts the SqlMoney operand to SqlDecimal.

Implicit(Int64 to SqlDecimal) Implicit(Int64 to SqlDecimal) Implicit(Int64 to SqlDecimal) Implicit(Int64 to SqlDecimal)

Converts the supplied Int64 structure to SqlDecimal.

Implicit(Decimal to SqlDecimal) Implicit(Decimal to SqlDecimal) Implicit(Decimal to SqlDecimal) Implicit(Decimal to SqlDecimal)

Converts the Decimal value to SqlDecimal.

Implicit(SqlInt64 to SqlDecimal) Implicit(SqlInt64 to SqlDecimal) Implicit(SqlInt64 to SqlDecimal) Implicit(SqlInt64 to SqlDecimal)

Converts the supplied SqlInt64 structure to SqlDecimal.

Implicit(SqlInt32 to SqlDecimal) Implicit(SqlInt32 to SqlDecimal) Implicit(SqlInt32 to SqlDecimal) Implicit(SqlInt32 to SqlDecimal)

Converts the supplied SqlInt32 structure to SqlDecimal.

Implicit(SqlInt16 to SqlDecimal) Implicit(SqlInt16 to SqlDecimal) Implicit(SqlInt16 to SqlDecimal) Implicit(SqlInt16 to SqlDecimal)

Converts the supplied SqlInt16 structure to SqlDecimal

Implicit(SqlByte to SqlDecimal) Implicit(SqlByte to SqlDecimal) Implicit(SqlByte to SqlDecimal) Implicit(SqlByte to SqlDecimal)

Converts the supplied SqlByte structure to SqlDecimal.

Inequality(SqlDecimal, SqlDecimal) Inequality(SqlDecimal, SqlDecimal) Inequality(SqlDecimal, SqlDecimal) Inequality(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.

LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal) LessThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.

LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal) LessThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.

Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal) Multiply(SqlDecimal, SqlDecimal)

The multiplication operator computes the product of the two SqlDecimal parameters.

Subtraction(SqlDecimal, SqlDecimal) Subtraction(SqlDecimal, SqlDecimal) Subtraction(SqlDecimal, SqlDecimal) Subtraction(SqlDecimal, SqlDecimal)

Calculates the results of subtracting the second SqlDecimal operand from the first.

UnaryNegation(SqlDecimal) UnaryNegation(SqlDecimal) UnaryNegation(SqlDecimal) UnaryNegation(SqlDecimal)

The unary minus operator negates the SqlDecimal parameter.

Explicit Interface Implementations

IXmlSerializable.GetSchema() IXmlSerializable.GetSchema() IXmlSerializable.GetSchema() IXmlSerializable.GetSchema()

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader)

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter)

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Applies to

See Also