Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHscriptreconwhereclause

  No additional text.


Syntax


-- Name:
--          sp_IHscriptreconwhereclause

-- Description:
--          Script reconciliation where clause

-- Security:
--          Public (for use by snapshot agent)

-- Returns:
--          Success or failure
--			Temp table (#proctext) of commands

-- Owner:
--          


create procedure sys.sp_IHscriptreconwhereclause
(
	@src_objid	int,
	@artid		int
)
as
begin
	declare @this_col int
	declare @art_col int
	declare @spacer nvarchar(10)
	declare @isset int
	declare @cmd nvarchar(4000)
	declare @col_name nvarchar(128)

	-- create WHERE clause

	select @art_col = 1
	select @spacer = N' '
	select @cmd = N'where'

	DECLARE hCColid CURSOR LOCAL FAST_FORWARD FOR
	select	ihc.publishercolumn_id, ihsc.name
	from	IHcolumns ihc,
			IHsyscolumns ihsc
	where	ihc.column_id = ihsc.colid
	  and	ihscid = @src_objid
	order by ihsc.colorder asc

	OPEN hCColid

	FETCH hCColid INTO @this_col, @col_name

	WHILE (@@fetch_status <> -1)
	begin
		exec @isset = sys.sp_IHisarticlecolbitset @this_col, @artid
		if @isset != 0 and EXISTS (select name from IHsyscolumns where id=@src_objid and @this_col=colid )
		begin
			exec @isset = sys.fn_IHiscolpk @this_col
			if @isset != 0
			begin
				select @cmd = @cmd + @spacer + QUOTENAME(@col_name) + N' = @c' + convert( nvarchar, @art_col )
				select @spacer = N' and '

				if len( @cmd ) > 3000
				begin
					insert into #proctext(procedure_text) values( @cmd )
					select @cmd = N''
				end
			end
			select @art_col = @art_col + 1
		end
		FETCH hCColid INTO @this_col, @col_name
	end
	CLOSE hCColid
	DEALLOCATE hCColid

	insert into #proctext(procedure_text) values( @cmd )
end

 
Last revision 2008RTM
See also

  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