In one of my solutions, i am using SQL Server's Change Tracking capabilities. To differentiate between changes made by the actual application and ones made by synchronizing applications, we are using Change Context. Now, this change context, as i know, is of type varbinary(128).
In the application logic, we create a byte array with some random bytes to be used as Change Context and when the synchronizing application makes any change, it uses this Change Context. Then, when we try to get the change set which were made by the actual application, with out any Change Context, we use the following code snippet in the query
SELECT .... from .... WHERE (SYS_CHANGE_CONTEXT != @context OR SYS_CHANGE_CONTEXT IS NULL)
Here, @context is command parameter that of type VARBINARY(128) which is added to the sqlcommand to get the change set. It would still get all the changes made regardless of the Change Context passed to the command.
Is there any special ways to compare VARBINARY values or send them as parameters??