Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgenerate_enumchangedcolumnvalues_query

  No additional text.


Syntax
create procedure sys.sp_MSgenerate_enumchangedcolumnvalues_query
	@objid int
as
	set nocount on

	declare @colid 			int
	declare @columnordinal	int
	declare @previouscolid	int
	declare @cmdpiece		nvarchar(4000)
	declare @colname		nvarchar(200)
	declare @METADATA_TYPE_InsertLightweight tinyint
	declare @METADATA_TYPE_UpdateLightweight tinyint

	set @METADATA_TYPE_InsertLightweight= 7
	set @METADATA_TYPE_UpdateLightweight= 8

	if @objid is null return (1)
	
	set @columnordinal= 0
	set @previouscolid= -1
	while (1=1)
	begin
		set @columnordinal= @columnordinal + 1
		
		set @colid= (select min(column_id) from sys.columns
						where object_id = @objid and
							  column_id > @previouscolid)

		if @colid is null
			break

		set @previouscolid= @colid

		select @colname= quotename(name) from sys.columns
							where object_id = @objid and
								  column_id = @colid

		set @cmdpiece= '
		case
			when @COLUMNS_ENUMERATED_AllOnOtherReason = rt.columns_enumeration then t.' + @colname + ' -- e.g., insert
			when @COLUMNS_ENUMERATED_AllOnConflictOrError = rt.columns_enumeration then t.' + @colname + ' -- conflict, error
			when 1 = sys.fn_MStestbit(rt.changedcolumns, ' + cast(@columnordinal as nvarchar(4)) + ') then t.' + @colname + ' -- locally modified
			else null -- locally unmodified
		end
		'

		if 1<>@columnordinal
		begin
			set @cmdpiece= ', ' + @cmdpiece
		end

		insert into #columnvaluequery (cmdtext) values (@cmdpiece)
	end

 
Last revision 2008RTM
See also

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