Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSreenable_check

  No additional text.


Syntax
create procedure sys.sp_MSreenable_check @objname sysname, @objowner sysname = NULL
as
    set nocount on

    declare @cnstname sysname
    declare @cnstid int
    declare @objid int
    declare @enable_cmd nvarchar(4000)
    declare @dest nvarchar(514)

    declare @retcode int
    IF @objname IS NULL
    BEGIN
        RAISERROR (14043, 16, -1, '@objname', 'sp_MSreenable_check')
        RETURN (1)
    END

    if(@objowner is not null)
        select @dest = quotename(@objowner) + N'.' + quotename(@objname)
    else
        select @dest = quotename(@objname)

    EXEC @retcode = sys.sp_MSreplcheck_publish
    IF @@ERROR <> 0 or @retcode <> 0
            return (1)

    select @objid = object_id(@objname)

    declare ms_crs_cnst cursor local static for
    select name, object_id
    	from sys.objects
    	where parent_object_id = @objid
    		and OBJECTPROPERTY(object_id, 'CnstIsDisabled') = 1
    		and OBJECTPROPERTY(object_id, 'CnstIsNotRepl') = 0
    		and (OBJECTPROPERTY(object_id, 'IsCheckCnst') = 1
    			or OBJECTPROPERTY(object_id, 'IsForeignKey') = 1)
	union
    select name, object_id
    	from sys.triggers
    	where parent_id = @objid
    		and OBJECTPROPERTY(object_id, 'IsTrigger') = 1
        	and OBJECTPROPERTY(object_id, 'ExecIsTriggerNotForRepl') = 0
        	and OBJECTPROPERTY(object_id, 'ExecIsTriggerDisabled') = 1
    for read only

    open ms_crs_cnst
    fetch ms_crs_cnst into @cnstname, @cnstid
    while @@fetch_status >= 0
    begin
        if(ObjectProperty(@cnstid, 'IsTrigger') = 1)
            select @enable_cmd = N'alter table ' + @dest + N' enable trigger ' + quotename(@cnstname)
        else
            select @enable_cmd = N'alter table ' + @dest + N' check constraint ' + quotename(@cnstname)

        execute(@enable_cmd)
        fetch ms_crs_cnst into @cnstname, @cnstid
    end     --of major loop
    deallocate ms_crs_cnst
    return 0

 
Last revision 2008RTM
See also

  sp_MSdefer_check (Procedure)
sp_MSdrop_repltran (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