Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MS_marksystemobject

  No additional text.


Syntax

---------------------------- sp_MS_marksystemobject 
-- FOR INTERNAL USE ONLY ... DO NOT DOCUMENT 
-- This procedure sets a bit in sysobjects.  This bit has no meaning, various
--	groups (starfigther, davinci, replication) use it for different things
-- MSQL makes no warranty, express or implied, on what objects will or will
--	not have this bit set.  Use at your own risk.

create procedure sys.sp_MS_marksystemobject
	@objname    nvarchar(517),  -- 517 is max for two part name
	@namespace	varchar(10) = NULL		-- database, server or null
as

    set nocount on
	declare @objid	int
	declare @owner	sysname,
			@ns		int,			-- namespace enumeration value
			@object	sysname

	-- ============================================================
	-- DEVNOTE:
	--	x_eonc_TrgOnServer		= 20,	// Namespace for Triggers on the Server
	--	x_eonc_TrgOnDatabase	= 21,	// Namespace for Triggers on Databases
	--  x_eonc_Standard			= 0		// Standard Namespace
	-- ============================================================
	
	if not (@namespace is NULL)
	begin
	select @ns = (case lower(@namespace)
				when 'server' then 20
				when 'database' then 21
				end)
	end
	else
	begin
		set @ns = 0 -- null means standard namespace
	end

	-- bail out on invalid namespace.
	if @ns is null
		begin
		raiserror('sp_MS_marksystemobject: Invalid NameSpace ''%ls''',0,1,@namespace)
		return (1)
	end

    -- CHECK THE OBJECT NAME 
	select @object = parsename(@objname, 1),
			@owner = parsename(@objname, 2)

	-- ============================================================
	-- DEVNOTE:
	--	x_eonc_TrgOnServer		= 20,	// Namespace for Triggers on the Server
	--	x_eonc_TrgOnDatabase		= 21,	// Namespace for Triggers on Databases
	-- ============================================================
	
	if @ns = 20 or @ns = 21
	begin
		if NOT (@owner is null)
		begin
			-- schema name specified for extended trigger. Error out
			raiserror(1094,-1,-1)
			return (1)
		end
	end
	
	-- use master db for server level trigger
	if @ns = 20
	begin
		select @objid = object_id from sys.server_triggers where name = @objname
	end
	else if @ns = 21
	begin
		select @objid = object_id from sys.triggers where name = @objname and parent_class = 0
	end
	else
	begin
		if @owner is null or @owner in ('dbo', 'cdc')
			select @objid = object_id(@objname, 'local')
	end
	

    -- CHECK THE OBJECT OWNER (MUST BE DBO) 
    -- DO THE UPDATE 
	BEGIN TRAN
	if not (@objid is null)
	begin
		if @ns = 0
		begin
			EXEC %%Object(MultiName = @objname).LockMatchID(ID = @objid, Exclusive = 1, BindInternal = 0)
			if @@error <> 0 or user_name(ObjectProperty(@objid, 'OwnerId')) not in ('dbo', 'cdc')
				select @objid = null
			else
			begin
				if @owner is null
					select @owner = N'dbo'

				EXEC %%Object( Owner = @owner, Name = @object ).SetSystem()

			end
		end
		else
		begin
			EXEC %%TriggerEx(MultiName = @objname).ValidateAndSetSystem(
													ID = @objid, NameSpaceClass = @ns)
		end
	end

	if @objid is null
	begin
		raiserror('sp_MS_marksystemobject: Invalid object name ''%ls''',0,1,@objname)
		COMMIT TRAN
		return (1)
	end

	COMMIT TRAN
    return (0)	-- sp_MS_marksystemobject

 
Last revision 2008RTM
See also

  sp_addsynctriggerscore (Procedure)
sp_cdc_add_job_internal (Procedure)
sp_cdc_create_change_table (Procedure)
sp_cdc_create_objects (Procedure)
sp_cdc_create_populate_stored_procs (Procedure)
sp_cdc_enable_db_internal (Procedure)
sp_cdc_lsn_time_mapping_procs (Procedure)
sp_cdc_vupgrade (Procedure)
sp_copysubscription (Procedure)
sp_createagentparameterlist (Procedure)
sp_dbmmonitorupdate (Procedure)
sp_logshippinginstallmetadata (Procedure)
sp_MSacquiresnapshotdeliverysessionlock (Procedure)
sp_MSaddmergetriggers (Procedure)
sp_MScdc_ddl_database_triggers (Procedure)
sp_MScdc_ddl_server_trigger (Procedure)
sp_MScreateandsetarticleprocs (Procedure)
sp_MScreatebeforetable (Procedure)
sp_MScreatedisabledmltrigger (Procedure)
sp_MScreatelightweightarticleprocs (Procedure)
sp_MScreatelightweightmetatables (Procedure)
sp_MScreate_article_logical_record_views (Procedure)
sp_MScreate_article_repl_view (Procedure)
sp_MScreate_common_dist_tables (Procedure)
sp_MScreate_distributor_tables (Procedure)
sp_MScreate_dist_tables (Procedure)
sp_MScreate_mergesystables (Procedure)
sp_MScreate_peer_tables (Procedure)
sp_MScreate_pub_tables (Procedure)
sp_MScreate_replication_status_table (Procedure)
sp_MScreate_subscription_properties_table (Procedure)
sp_MScreate_sub_tables_internal (Procedure)
sp_MScreate_sysmergeschemaarticles_table (Procedure)
sp_MScreate_tempgenhistorytable (Procedure)
sp_MSdropfkreferencingarticle (Procedure)
sp_MSgenerate_articlechangemembershipevaluation_proc (Procedure)
sp_MSgen_sync_tran_procs (Procedure)
sp_MSgetconflictinsertproc (Procedure)
sp_MSgettablecontents (Procedure)
sp_MSmakeconflicttable (Procedure)
sp_MSmakectsview (Procedure)
sp_MSmakedynsnapshotvws (Procedure)
sp_MSmakegenerationidentity (Procedure)
sp_MSmakepeerconflicttable (Procedure)
sp_MSmakesystableviews (Procedure)
sp_MSmaketrancftproc (Procedure)
sp_MSmakeviewproc (Procedure)
sp_MSmerge_create_pub_table (Procedure)
sp_MSmerge_create_sub_table (Procedure)
sp_MSpostapplyscript_forsubscriberprocs (Procedure)
sp_MSpublicationview (Procedure)
sp_MSrecordsnapshotdeliveryprogress (Procedure)
sp_MSrepl_articlefilter (Procedure)
sp_MSrepl_articleview (Procedure)
sp_MSrepl_createdatatypemappings (Procedure)
sp_MSrepl_ddl_triggers (Procedure)
sp_MSrepl_startup_internal (Procedure)
sp_MSsetconflicttable (Procedure)
sp_MSsetup_partition_groups_table (Procedure)
sp_MSsetup_publication_for_partition_groups (Procedure)
sp_MS_marksystemobjectwitherror (Procedure)
sp_refreshreplsysservers (Procedure)
sp_replmonitorinitializemetrics (Procedure)
sp_SetInternalTableAccess (Procedure)
sp_vupgrade_distdb (Procedure)
sp_vupgrade_mergetables (Procedure)
sp_vupgrade_publisherdb (Procedure)
sp_vupgrade_replication (Procedure)
sp_vupgrade_replmsdb (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