Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSexclause

  No additional text.


Syntax

create procedure sys.sp_MSexclause  @tablenick int, @pubid uniqueidentifier, @phase int  as
set nocount on
declare @clause nvarchar(4000)
declare @filterid int
declare @joinnick int
declare @qualified_jointable nvarchar(517)
declare @unqualified_jointable nvarchar(270)
declare @qualified_basetable nvarchar(517)
declare @unqualified_basetable nvarchar(270)
declare @filter_clause nvarchar(2000)
declare @retcode int

exec @retcode= sys.sp_MStablenamefromnick @tablenick, @qualified_basetable out, NULL, @unqualified_basetable out
if @@error<>0 or @retcode<>0 return(1)

declare f_c CURSOR LOCAL FAST_FORWARD for  select art_nickname, join_filterclause
    from dbo.sysmergesubsetfilters where join_nickname = @tablenick and pubid = @pubid and filter_type = 1
    and exists (
                                        select * from dbo.sysmergearticles
                                        where nickname = @tablenick
                                        and pubid in
                                        (
                                                select pubid from dbo.sysmergepublications where use_partition_groups <= 0
                                        )
                                )
    FOR READ ONLY
open f_c
fetch next from f_c into @joinnick, @filter_clause
while (@@fetch_status <> -1)
    begin
    exec @retcode= sys.sp_MStablenamefromnick @joinnick, @qualified_jointable out, NULL, @unqualified_jointable out

    if @@error<>0 or @retcode<>0 goto Failure
    -- As helper proc for sp_MSmakeinsertproc, we can insert directly to the
    -- temp table as we build up more commands for the insert proc.
    -- Our commands are part of phase 8...
    set @clause = '
        if @resend = 0
        begin
            if exists (select 1 from ' + @qualified_basetable + ' ' + @unqualified_basetable + ' with (NOLOCK) , ' +
                        @qualified_jointable + ' ' + @unqualified_jointable + ' with (NOLOCK) where '

    insert into #tempcmd (phase, cmdtext) values (@phase, @clause)

    set @clause = @filter_clause

    insert into #tempcmd (phase, cmdtext) values (@phase, @clause)

    set @clause =
            ' and ' + @unqualified_basetable + '.rowguidcol = @rowguid)
                select @resend = 1
        end
'
    insert into #tempcmd (phase, cmdtext) values (@phase, @clause)

    fetch next from f_c into @joinnick, @filter_clause
    end

close f_c
deallocate f_c

return(0)

Failure:
    close f_c
    deallocate f_c
    return(1)

 
Last revision 2008RTM
See also

  sp_MSdrop_rlrecon (Procedure)
sp_MSmakeinsertproc (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