sp_get_redirected_publisher (Transact-SQL)
Used by replication agents to query a distributor to determine whether the original publisher has been redirected.
redirected_publisher returns the current publisher name. Returns null if the publisher and publishing databases have not been redirected using sp_redirect_publisher.
If validation is not requested or if no entry exists for the publisher and the publishing database, error_number and error_severity return 0 and error_message returns null.
If validation is requested, the validation stored procedure sp_validate_redirected_publisher (Transact-SQL) is called to verify that the target of the redirection is a suitable host for the publishing database. If the validation succeeds, sp_get_redirected_publisher returns the redirected publisher name, 0 for the error_number and error_severity columns, and null in the error_message column.
If validation is requested and fails, the redirected publisher name is returned along with error information.