I'm looking into using a pre-snapshot script to prevent the snapshot from being applied if certain conditions exist on the subscriber. I've tested this and it works well, but I have a few questions that I couldn't find answers for in the documentation (starting with this: https://msdn.microsoft.com/en-us/library/ms152525.aspx).
My application has to write out this script to the file system during installation. Where should this pre-snapshot script be saved to? The snapshot folder? A hardcoded location like C:\PreSnapshotScripts\?
What is the best way to send an error up to the Snapshot Agent? Currently I'm using RAISERROR, and the error is showing up in Replication Monitor (which is seems to be showing records from [distribution].[dbo].[MSdistribution_history]). However, the error shows up like this "Last 85 characters in 'sqlcmd' output buffer: Msg 50000, Level 11, State 1, Server MyServer\MyInstance, Line 9 Why hello there StackOverflow". Is there a way to just show a line that says "Why hello there StackOverflow"? If not, that's fine. I expect this to be a rare condition, and the customer will probably contact me about it no matter what it says!
Thanks