Sql-server – How to split tables without affecting all stored procedures

sql serversql-server-2008-r2

We have merge replication setup between corporate database and remote clients. Lately we realized that people working on the corporate server do not need data to be tracked by merge replication as this data does not need to flow down to remote clients. We have decided to split tables between remote clients and people working on the corporate server.

Eg: Table1 has all data for remote clients as well as for people on corporate server. After table splitting, we want it to be Table1 for remote clients and Table2 for people on the corporate server.

To accomplish this I will have to change all my stored procedures for inserting and updating records in table1 and table2. First I have to find records in table1 and in case I don't find records in table1, I have to search records in table2 and then perform crud operations on the record.

Is there any easy way to accomplish this? A way where I don't have to change every stored procedure? I am aware of creating a view over table1 and table2, then create an instead of insert trigger on the view and write logic in trigger to insert into table1 and table2. Is anybody aware of any other way of accomplishing this kind of change?

Best Answer

I may be missing something, but instead of splitting tables, have you considered parameterized filters?

Parameterized filters allow different partitions of data to be sent to different Subscribers without requiring multiple publications to be created. For example, a table can be filtered so that data for a given sales representative is replicated only to that representative. Parameterized filters have a variety of options that allow you to tailor filtering to optimize performance and best match your data and application requirements. For more information, see Parameterized Row Filters.