Database Reference
In-Depth Information
2.
To capture relevant information about the publisher name, which is used in other
scripts below, ensure that you use a variable:
DECLARE @publisher_namesysname
set @publisher_name =(select name from msdb..MSdistpublishers
where
name=@@servername);
SELECT @publisher_name;
3.
Drop the publisher, local distributor, and distribution database, by entering the
following code:
--Are there other Publishers using this Distributor?
execsp_get_distributor;
execsp_dropdistpublisher @publisher=@publisher_name,@no_checks=0;
declare @distributiondb as sysname;
set @distributiondb =(select name from sys.sysdatabases where name
='distribution');
execsp_dropdistributiondb @distributiondb;
execsp_dropdistributor;
go
4. Now configure the distributor server and publisher server configuration using the
following TSQL script:
Use master
go
/* Obtain default instance name as the Distributor*/
declare @distributor as sysname = convert(sysname,
serverproperty('servername'));
/*Set the @distributorserver_msg variable */
declare @distributorserver_msg as varchar(50)='The name of the
Distributor server.';
SELECT @distributorserver_msg + ' ' +@distributor;
/* Add the Distributor */
execsp_adddistributor @distributor=@distributor;
/* Install the distribution database on the default directory to
use Windows authentication */
declare @distributiondb as sysname ='distribution';
execsp_adddistributiondb@database=@distributiondb,@security_
mode=1;
go
 
Search WWH ::




Custom Search