Search code examples
sql-serverreplication

How to determine if the SQL Server supports replication


I have a UI that needs certain portions to be disabled if the SQL Server it's connecting to does not support replication and which types of replication it supports (snapshot, merge, transactional). I looked through the doc for the SERVERPROPERTY function, but didn't see anything that looked like it was what I needed. Any suggestions?

Note - It would be preferable to not have to resort to switching on the Edition.


Solution

  • So it looks like there is no easy way to determine if replication is supported, however, it is possible to determine if the database is being replicated:

    SELECT name, CASE WHEN is_published = 1 OR is_merge_published = 1 OR is_distributor = 1 THEN 1 ELSE 0 END AS uses_replication FROM sys.databases
    

    That's about as close as I can get I think.