Today I looked specifically at what the school check functions under SQL Server are. Originally I just used a checksum in the work, and today I learned a little bit to find that there are other school check functions.
Here's a summary of what others have learned about the functions of the school tests under SQL Server, and take this opportunity to learn from others ' learning outcomes.
Http://bbs.51cto.com/thread-1145105-1.html
CHECKSUM and Binary_checksum
- Checksum and Binary_checksum are both single-or multiple-column or expression-based values that can be generated for a row in a table with a data type of int.
- The difference is that the binary_checksum is the calibration value that is generated after the binary is turned into binary.
- Not all data types can be used on checksum or binary_checksum. BInary_checksum columns with an irreducible data type are ignored in the calculation.The non-comparable data types includeTextntextimage, cursor, xml and non-comparable common language runtime (CLR) user-defined types.
- MSDN mentions that binary_checksum can be used to detect changes in rows in a table. However, it is also mentioned that Binary_checksum (*) will return different values for most (but not all) row changes and can be used to detect most row modifications.
- Because the value of the test is an int, according to the numerical distribution of int [ -2147483648,2147483647], if the number of rows in a long table is greater than 200 million The estimate will occur. This has come to you in previous work.
- The differences between checksum and Binary_checksum are: 1) checksum is case insensitive. It thinks that Jerry and Jerry are the same school-checking values; 2) If two expressions have the same type and byte representation, the same value will be returned for Binary_checksum. For example, Binary_checksum for "2VOLVO director 20" and "3VOLVO director 30" will return the same value. This paragraph references the http://ultrasql.blog.51cto.com/9591438/1607407
Checksum_agg
This is an aggregation function.Returns the checksum for each value in the group.Null values are ignored. You can follow the over clause later. The Checksum_agg is used to detect changes in the table. If a value in the expression list changes, the checksum of the list is usually changed. But in rare cases, the checksum remains the same. In many cases, this function should be used to detect whether the data in the table has changed or if the data for a field in the table has changed.
Hashbytes Returns the MD2, MD4, MD5, SHA, SHA1, or SHA2 hashes of its input in SQL Server. You can replace checksum or binary_checksum with MD5 to avoid duplication. However, performance may be degraded.
SQL Server->> Check functions CHECKSUM, Checksum_agg, Binary_checksum, and hashbytes