Question 1: What is Binary_checksum?
This is the one function which is used for identify the row change or update in the Row in a Table object. Actually this function return the Record Updated number. Using this we can know about the Is value changed or not in a Table.
Example: Run this script in SSMS it's very interesting -
CREATE TABLE TestTable (column1 varchar(50));
GO
-- Insert Value
INSERT INTO TestTable VALUES ('Jai');
GO
-- Check the Checksum Value
SELECT BINARY_CHECKSUM(*)
AS BINARY_CHECKSUM_VALUE FROM TestTable;
GO
-- Change the value of table row
UPDATE TestTable SET column1 = ('J verma');
GO
-- Check the Checksum
SELECT BINARY_CHECKSUM(*)
AS BINARY_CHECKSUM_VALUE FROM TestTable;
GO
-- Change the value of table row
UPDATE TestTable SET column1 = ('Jainendra');
GO
-- Check the Checksum
SELECT BINARY_CHECKSUM(*)
AS BINARY_CHECKSUM_VALUE FROM [TestTable];
GO
-- Change the value of table row
UPDATE TestTable SET column1 = ('Jai');
GO
-- Check the Checksum
SELECT BINARY_CHECKSUM(*)
AS BINARY_CHECKSUM_VALUE FROM [TestTable];
GO
-- Drop table object for good practice
DROP TABLE [dbo].[TestTable]
GO
Question 2: What is Drawback of BINARY_CHECKSUN ?
In the above example you inserting value that is 'Jai' than you will get BINARY_CHECKSUN value (eg. 4544673) than you are updating value 'J verma' than you will get different BINARY_CHECKSUN value (eg 6564563)same as will get in 'Jainendra' but when update again privous value 'Jai' in the colunm than you will get the same BINARY_CHECKSUN value(eg 4544673) means you will no identify the updation of Row in the Table.
No comments:
Post a Comment
Thank You !!!!