Row filtering in merge replication

  • I'm trying to implement some row filtering on a merge publication with a push subscription. The usually business of sending only certain rows to the subscribers.

    I have a table, with an integer column, that is a bitmask saying which subscribers are allowed each row. My filterclause is this:-

    dbo.BitwiseAnd( ( SELECT MRes_EnumID FROM dbo.SS_Studio WHERE MRes_Server = CONVERT(nvarchar(32), SERVERPROPERTY('ServerName')) ), Res_StudioMask ) != 0

    Table dbo.SS_Studio, just relates each server name with a number. The function dbo.BitwiseAnd does exactly as it says.

    Don't know if its quite a efficient as it could be, but for the time being it doesn't work! The subscriber just gets all rows regardless.

    If I run the above filter manually on the subscriber, it returns just the rows I want. Any ideas?

  • Looks like I'm on a role in solving my own problems...

    Anyway, the solution to this one, was to use HOST_NAME() instead of SERVERPROPERTY('ServerName').

    Not entirely sure why. I think I originally used the latter, because in my testing it returned the server name, whereas the former returned the name of my personal workstation machine.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply