We have an app that uses a central SQL Server 2008 database for folks here in the building on the domain. For teams out in the field - they connect to a local version of SQL Express while offline and then sync with the main server when able via
merge replication. Both inhouse and field teams use the same application on top of the database. The application doesn't care if it's attached to the publisher database or subscriber.
From time to time we need to run a stored procedure on the subscribers.
My first thought is to write into the procedure an
if begin end statement that checks for the existence of the
dbo.MSsubscription_properties table in the
System Tables of the database.
Since this table doesn't exist at the publisher (as long as the publisher it's self doesn't subscribe to some other publication - which we have no plans on doing) it seems to be an easy way to distinguish that the connection is attached to a subscriber vs the publisher.
Is there a better (documented) way to identify subscriber vs publisher that I'm overlooking? Any reason why my approach would produce an unpredictable result.