Working on a new server, I came across a replication process that had been forgotten about and the pieces were disconnected.  The distributor server/process had been installed on another server and when I went to remove the publisher from the database, I got the below error.

[sourcecode language=”sql”]
DECLARE @publication AS sysname;
SET @publication = N’SmokeTest’;

— Remove a transactional publication.
USE [ReportServerTempDB]
EXEC sp_droppublication @publication = @publication;
[/sourcecode]

OLE DB provider “SQLNCLI10” for linked server “repl_distributor” returned message “Login timeout expired”.OLE DB provider “SQLNCLI10” for linked server “repl_distributor” returned message “A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.”.
Msg 11001, Level 16, State 1, Line 0
TCP Provider: No such host is known.

The linked server was pointing to a server that no longer existed and I thought I was stuck.  I tried lots of options, but ultimately came across this blog that demonstrated how to forcefully remove the publisher when I couldn’t connect to the distributor.

Spoiler: The trick is to use the @ignore_distributor=1 parameter and you should be good to go.

[sourcecode language=”sql”]
DECLARE @publication AS sysname;
SET @publication = N’SmokeTest’;

— Remove a transactional publication.
USE [ReportServerTempDB]
EXEC sp_droppublication @publication = @publication<code>
,@ignore_distributor=1</code>;
[/sourcecode]