SqlUserDefinedTypeAttribute.IsByteOrdered SqlUserDefinedTypeAttribute.IsByteOrdered SqlUserDefinedTypeAttribute.IsByteOrdered SqlUserDefinedTypeAttribute.IsByteOrdered Property


指示用户定义的类型是否根据字节进行排序。Indicates whether the user-defined type is byte ordered.

 property bool IsByteOrdered { bool get(); void set(bool value); };
public bool IsByteOrdered { get; set; }
member this.IsByteOrdered : bool with get, set
Public Property IsByteOrdered As Boolean


如果用户定义的类型是按字节进行排序的,则为 true;否则为 falsetrue if the user-defined type is byte ordered; otherwise false.


如果设置为true,则IsByteOrdered属性实际上保证,可用于序列化的二进制数据的信息的语义排序。When set to true, the IsByteOrdered property in effect guarantees that the serialized binary data can be used for semantic ordering of the information. 因此,字节顺序的 UDT 对象的每个实例只能有一种序列化表示形式。Thus, each instance of a byte-ordered UDT object can only have one serialized representation. 时在 SQL Server 中对序列化字节执行比较运算,其结果应为相同的相同的比较操作好像在托管代码中执行的位置。When a comparison operation is performed in SQL Server on the serialized bytes, its results should be the same as if the same comparison operation had taken place in managed code.

支持以下功能时IsByteOrdered设置为true:The following features are supported when IsByteOrdered is set to true:

  • 此类型的列上创建索引的功能。The ability to create indexes on columns of this type.

  • 创建主键和外键以及 CHECK 和 UNIQUE 约束,此类型的列上的功能。The ability to create primary and foreign keys as well as CHECK and UNIQUE constraints on columns of this type.

  • 能够使用 TRANSACT-SQL ORDER BY、 GROUP BY 和 PARTITION BY 子句。The ability to use Transact-SQL ORDER BY, GROUP BY, and PARTITION BY clauses. 在这些情况下,该类型的二进制表示形式用于确定的顺序。In these cases, the binary representation of the type is used to determine the order.

  • 能够在 TRANSACT-SQL 语句中使用比较运算符。The ability to use comparison operators in Transact-SQL statements.

  • 可以保存此类型的计算的列。The ability to persist computed columns of this type.

请注意,同时NativeUserDefined序列化格式支持以下比较运算符时IsByteOrdered设置为true:Note that both the Native and UserDefined serialization formats support the following comparison operators when IsByteOrdered is set to true:

  • 等于 (=)Equal to (=)

  • 不等于 (!=)Not equal to (!=)

  • 大于 (>)Greater than (>)

  • 小于 (<)Less than (<)

  • 大于或等于 (>=)Greater than or equal to (>=)

  • 小于或等于 (<=)Less than or equal to (<=)