Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MScopyscriptfile_merge

  No additional text.


Syntax



-- Name: sp_MScopyscriptfile_merge

-- Descriptions:

-- Parameters: as defined in create statement

-- Returns: 0 - success
--          1 - Otherwise

-- Security: internal
-- Requires Certificate signature for catalog access

create procedure sys.sp_MScopyscriptfile_merge (
    @publication sysname,
    @scriptfile nvarchar(4000),
    @cmd nvarchar(4000) OUTPUT
)
as
declare @directory nvarchar(4000)
declare @filename nvarchar(1024)
declare @subdirectory nvarchar(1024)
declare @retcode int
declare @publisher sysname
declare @publisher_db sysname
declare @enabled_for_internet bit
declare @snapshot_in_defaultfolder bit

declare @distributor            sysname
declare @dist_rpcname           sysname
declare @distribdb              sysname
declare @distproc               nvarchar(300)
declare @distrib_directory     nvarchar(4000)

select @publisher = publishingservername()
select @publisher_db = db_name()


EXEC @retcode = sys.sp_helpdistributor @distributor = @distributor OUTPUT,
                                        @distribdb = @distribdb OUTPUT,
                                        @rpcsrvname = @dist_rpcname OUTPUT ,
                                        @directory = @distrib_directory OUTPUT

if @@error <> 0 OR @retcode <> 0 or @distributor IS NULL OR @distribdb IS NULL
BEGIN
    RAISERROR (14071, 16, -1)
    RETURN (1)
END

select @directory = alt_snapshot_folder,
       @enabled_for_internet = enabled_for_internet,
       @snapshot_in_defaultfolder = snapshot_in_defaultfolder from dbo.sysmergepublications
where UPPER(publisher) = UPPER(@publisher)  and publisher_db = @publisher_db and name = @publication
if @directory is null or @directory = ''
begin
    select @directory = @distrib_directory
end

-- determine whether to use unc or ftp subdir. This is based on the "enabled_for_internet" property of
-- the publication
if @enabled_for_internet = 0
    select @directory = @directory + '\unc\' +
             sys.fn_replcomposepublicationsnapshotfolder(@publisher,@publisher_db,@publication,1) collate database_default
else
    select @directory = @directory + '\ftp\' +
             sys.fn_replcomposepublicationsnapshotfolder(@publisher,@publisher_db,@publication,1) collate database_default

-- the subdirectory will be directory called "UserScripts"
select @subdirectory = formatmessage(21721)
if(right(@directory, 1) = N'\')
    select @directory = @directory + @subdirectory
else
    select @directory = @directory + N'\' + @subdirectory


SELECT @distproc = RTRIM(@dist_rpcname) + '.' + QUOTENAME(@distribdb) + '.dbo.sp_MSreplcopyscriptfile'

EXECUTE @retcode = @distproc @directory = @directory, @scriptfile = @scriptfile

if @@error<>0 or @retcode<>0
    return 1

-- Prepare command, to be posted to log
select @filename = right(@scriptfile, charindex(N'\', reverse(@scriptfile)))
if(left(@filename, 1) = N'\')
    select @cmd = @directory + @filename
else
    select @cmd = @directory + N'\' + @filename

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (Procedure)
sp_MSrepl_addscriptexec (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash