When you setup a publication or subscription in a server where replication is not installed, you will get the below error.
Msg 22001, Level 1, State 1
Msg 21028, Level 16, State 1, Procedure sp_MS_replication_installed, Line 35 (Batch Start Line 0)
Replication components are not installed on this server. Run SQL Server Setup again and select the option to install replication.
To check whether SQL Server replication is installed in a server or not, you can use the below methods.
SQL Server Installation Center
Toolsand then click
Installed SQL Server features discovery reporton the right side.
- Check the features report whether the Replication is configured or not.
Execute the below query and check the result. If it returns 1, then replication is installed in the server. This stored procedure is actually checking the registry and returns the result.
DECLARE @replication_installed int; EXEC @replication_installed = master.sys.sp_MS_replication_installed; SELECT @replication_installed;
Read the registry and find whether SQL Server replication is installed or not. If installed, you will get value as 1 in Data column.
EXECUTE master.dbo.xp_instance_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\MSSQLServer\Replication', 'IsInstalled'