Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSlocktable

  No additional text.


Syntax
create procedure sys.sp_MSlocktable
(
@ownername        sysname,
@tablename        sysname
)
AS
begin
    declare @retcode            int
            ,@procname            sysname
            ,@objid                 int
            ,@qualified_name        nvarchar(300)
            ,@spretcode int
            ,@spcall nvarchar(256)

    if @ownername is null
        set @qualified_name= QUOTENAME(@tablename)
    else
        set @qualified_name= QUOTENAME(@ownername) + '.' + QUOTENAME(@tablename)

    select @objid = object_id(@qualified_name)
    if @objid is NULL
        select @objid = object_id from sys.objects where name=@tablename
    if @objid is null
        return (1)

    exec @retcode = sys.sp_MSrepl_PAL_rolecheck @objid = @objid
    if ((@retcode <> 0) or (@@error <> 0))
        return 1

    if 1=sys.fn_MSuselightweightreplication(null, null, null, null, null, null, @objid)
    begin
        
        -- For security: break ownership chain as
        -- we have no control over the proc name is
        
        select @procname= 'dbo.MSmerge_lws_sp_multi_' + procname_postfix from dbo.sysmergearticles where objid = @objid
                            and (1 = {fn ISPALUSER(pubid)})
        select @spcall = N'exec @p1 = ' + @procname + N' @action = 4 '
        exec @retcode = sys.sp_executesql @stmt = @spcall
            ,@params = N'@p1 int output'
            ,@p1 = @spretcode output
        IF @@ERROR<>0 or @retcode<>0 or @spretcode != 0
            RETURN (1)
    end
    else
    begin
        
        -- For security: break ownership chain as
        -- we have no control over the proc name is
        
        select @procname = 'dbo.' + select_proc from dbo.sysmergearticles where objid = @objid
                        and (1 = {fn ISPALUSER(pubid)})
        select @spcall = N'exec @p1 = ' + @procname + N' @maxschemaguidforarticle = NULL, @type = 7 '
        exec @retcode = sys.sp_executesql @stmt = @spcall
            ,@params = N'@p1 int output'
            ,@p1 = @spretcode output
        IF @@ERROR<>0 or @retcode<>0 or @spretcode != 0
            RETURN (1)
    end
end

 
Last revision 2008RTM
See also

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