Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MScreatelightweightmetatables

  No additional text.


Syntax
create procedure sys.sp_MScreatelightweightmetatables
as
	declare @retcode int
	
	if object_id('dbo.MSmerge_rowtrack', 'U') is null
	begin
		-- IMPORTANT: If the MSmerge_rowtrack schema changes, adjust sp_MSget_MSmerge_rowtrack_colinfo.
		create table dbo.MSmerge_rowtrack
		(
			tablenick			int not null,
			rowguid				uniqueidentifier not null,
            changetype          tinyint null, -- bcp fails if this is not null
			changed				int not null,
			rowvector			varbinary(11) null,
			changedcolumns		varbinary(128) null,
			columns_enumeration	tinyint not null, -- COLUMNS_ENUMERATED
			-- sync_cookie is set upon enumerating a change. It allows to determine
			-- for what publisher/publication the upload takes place.
			sync_cookie			int null
		)
		if @@error <> 0 goto Error
		exec dbo.sp_MS_marksystemobject MSmerge_rowtrack
		if @@error <> 0	goto Error
		grant select on dbo.MSmerge_rowtrack to public

		create unique clustered index ucMSmerge_rowtrack on dbo.MSmerge_rowtrack(tablenick, rowguid)
		if @@error <> 0 goto Error
	end

    exec @retcode = sys.sp_MSmerge_create_sub_table
	if @@error<>0 or @retcode<>0 goto Error
	
    exec @retcode = sys.sp_MSmerge_create_pub_table
	if @@error<>0 or @retcode<>0 goto Error

	if object_id('dbo.MSmerge_filteringcolumns_lightweight', 'U') is null
	begin
		create table dbo.MSmerge_filteringcolumns_lightweight
		(
			publication_id		uniqueidentifier not null,
			tablenick 			int not null,
			column_id	int not null
		)
		if @@error <> 0 goto Error

		exec dbo.sp_MS_marksystemobject MSmerge_filteringcolumns_lightweight
		if @@error <> 0	goto Error
		grant select on dbo.MSmerge_filteringcolumns_lightweight to public
	end
	
	if object_id('dbo.MSmerge_idrange', 'U') is null
	begin
		create table dbo.MSmerge_idrange
		(
			objid			int not null primary key, -- Creates a clustered index.
			max_identity	bigint null,
			range			bigint null,
			threshold		int null
		)
		if @@error <> 0 goto Error
		exec dbo.sp_MS_marksystemobject MSmerge_idrange
		if @@error <> 0	goto Error
		grant select on dbo.MSmerge_idrange to public
	end

	if object_id('dbo.MSmerge_supportability_settings', 'U') is null
    begin
        create table dbo.MSmerge_supportability_settings (
	            pubid                uniqueidentifier    NULL,
	            subid                uniqueidentifier    NULL,
	            web_server    		 sysname             NULL,
	            constraint           unique_supportpubsrvdb     unique nonclustered (pubid, subid, web_server),
	            support_options      int NOT NULL default(0),	-- check the SUPPORT_OPTIONS enum in agent code.
                log_severity		 int NOT NULL default(2),
                log_modules			 int NOT NULL default(0),
                log_file_path		 nvarchar(255) NULL,
                log_file_name		 sysname NULL,
                log_file_size		 int NOT NULL default(10000000),
                no_of_log_files		 int NOT NULL default(5),
                upload_interval 	 int NOT NULL default(0),
                delete_after_upload	 int NOT NULL default(0),
                custom_script		 nvarchar(2000) NULL,
                message_pattern              nvarchar(2000) NULL,
            last_log_upload_time datetime            NULL
                )
        if @@ERROR <> 0 goto Error

        exec dbo.sp_MS_marksystemobject MSmerge_supportability_settings
        --grant select on dbo.MSmerge_supportability_settings to public
    end

	if object_id('dbo.MSmerge_log_files', 'U') is null
    begin
        create table dbo.MSmerge_log_files (
                id 					 int identity(1,1),
	            pubid                uniqueidentifier    NULL,
	            subid                uniqueidentifier    NULL,
	            web_server		     sysname			 NULL,
	            file_name            nvarchar(2000)      NOT NULL,
	    upload_time 		 datetime 			 NOT NULL default getdate(),
	            log_file_type	     int    			 NOT NULL, -- Check UPLOAD_LOG_FILE_TYPE enum in agent code.
	            log_file			 varbinary(max) 	 NULL
                )
        if @@ERROR <> 0 goto Error

        create clustered index ucMSmerge_log_files on MSmerge_log_files(pubid, subid, id)
        if @@ERROR <> 0 goto Error

        exec dbo.sp_MS_marksystemobject MSmerge_log_files
        --grant select on dbo.MSmerge_log_files to public
    end

	if object_id('dbo.MSsubscription_properties', 'U') is null
	begin
		exec @retcode= sys.sp_MScreate_subscription_properties_table
		if @@error <> 0 or @retcode <> 0 goto Error
	end
	
	if object_id('dbo.sysmergeschemaarticles', 'U') is null
	begin
		exec @retcode= sys.sp_MScreate_sysmergeschemaarticles_table
		if @@error <> 0 or @retcode <> 0 goto Error
	end
	
    if object_id('dbo.sysmergeextendedarticlesview', 'V') is not null
        drop view dbo.sysmergeextendedarticlesview
	if @@error<>0 goto Error

	exec @retcode= sys.sp_MScreate_sysmergeextendedarticlesview
	if @@error<>0 or @retcode<>0 goto Error

	return(0)

Error:
	raiserror(20008, 16, -1)
	return(1)

 
Last revision 2008RTM
See also

  sp_MScreate_mergesystables (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