Masking or substring data while replicating data I  have a table that has  some  unencrypted data  that needs to be replicated to another server. I want to do :


Mask the data with an x except the last 5 characters e.g.  xxxx12345  
just replicate the last 5 characters of the data in the column (substr the last 5 characters)


Is there a way I can do that other than writing a trigger on the subscriber ?

Thanks

R
Yes, you can use custom replication stored procedures to do this.  Custom replication stored procedures are especially useful when an application requires custom logic such as this and can allow the data to be transformed in-flight to Subscribers.

Have a look at the sections Default and custom stored procedures and Considerations for Using Custom Stored Procedures in Specify How Changes Are Propagated for Transactional Articles, and the section To generate and use custom stored procedures in Set the Propagation Method for Data Changes to Transactional Articles.