Hello Brian,  
Thanks for your reply.  
We got this error while using the Red-Gate toolkit bundle as well as the SQL Datacomapre 5.2. commercial release both. Intially we got the error in the .net code then we tried with the commercial relase & the got the same error. I have the screen shot for the error but i don't have any means to attach the image for the error over here.  
As i said that this error occurs only during the update of a DB having a table with 'ntext' datatype. And that to be the fauilre occurs only for insert script not for the update script.  
Intially when there is no data into the table then the insert works fine but if we have some data into it & try to synchronize for adding the new data & updating the old data in the target database then this error flashese.  
Please let me know some email id so that i can send you the error screen for your reference.  
Also the .Net code snippet & the table script in which we are getting error as below:   Code Snippet 1. First we are excluding the entire table mapping 
tablemappings.CreateMappings(dbCompareSource.Tables, dbCompareDestination.Tables)
                For counter = 0 To tablemappings.Count - 1
                    tablemappings(counter).Include = False
                Next
 
2. Calling a function with the where condition and comparison columns and include that table in the table mapping
 
The function has the follwing code
 
For Each mapping In mappings
                If (mapping.Obj1.Name = tablename) Then
                    If (ComparisionColumns <> "") Then
                        mapping.MatchingMappings.Clear()
                        strarr = ComparisionColumns.Split(",")
                        For Each columnnames As String In strarr
                            mapping.MatchingMappings.Add(mapping.FieldMappings(columnnames))
                        Next
                        mapping.RefreshMappingStatus()
                        If CheckTargetRecord(tablename, Batchid) > 0 Then
                            If Not (mapping.IndexMappings.PrimaryKey Is Nothing) Then
                                For counter = 0 To mapping.IndexMappings.PrimaryKey.Obj1.Fields.Count - 1
                                    mapping.FieldMappings(mapping.IndexMappings.PrimaryKey.Obj1.Fields(counter).Name).Include = False
                                Next
                            End If
 
                            For counter = 0 To mapping.Obj1.Fields.Count - 1
                                If (mapping.Obj1.Fields(counter).Identity = True) Then
                                    mapping.FieldMappings(mapping.Obj1.Fields(counter).Name).Include = False
                                End If
                            Next
                        End If
                        If Trim(condition) <> "" Then
                            mapping.Where = New WhereClause(condition)
                            If blDataAppend = False Then
                                DeleteRecords(tablename, condition, Batchid)
                            End If
                        End If
                        mapping.Include = True
                        End If
                        Exit For
            End If
 
Next
 
 
 
3. Then finally we are comparing the two databases with the new mappings and generating the script. The script generated has the MISSING value.
 
DataSession.CompareDatabases(dbCompareSource, dbCompareDestination, tablemappings, SessionSettings.IncludeRecordsInOne + SessionSettings.IncludeDifferentRecords)
block = DataProvider.GetMigrationSQL(DataSession, True)
  Script of the Table CREATE TABLE [dbo].[cfgReport](
      [ReportID] [int] IDENTITY(1,1) NOT NULL,
      [UserID] [int] NULL,
      [ReportName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportClassName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportDescription] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [SchemaName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_cfgReport_DefaultQueryColumn]  DEFAULT (1),
      [PackageType] [nvarchar](16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportModule] [nvarchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportType] [nvarchar](25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportTypeSub1] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [ReportXml] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [DefaultQuery] [nvarchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [DefaultQueryLink] [nvarchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CONSTRAINT [DF_cfgReport_DefaultQueryLink]  DEFAULT (N'all'),
      [DefaultQueryColumn] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [DefaultQueryOperator] [nvarchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_cfgReport_DefaultQueryOperator]  DEFAULT (N'Equal'),
      [QueryRequired] [bit] NOT NULL CONSTRAINT [DF_cfgReport_QueryRequired]  DEFAULT (1),
      [OrderBy] [nvarchar](1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [MasterSuretyID] [int] NULL CONSTRAINT [DF_cfgReport_MasterSuretyID]  DEFAULT (0),
      [DeleteFlag] [bit] NULL CONSTRAINT [DF_cfgReport_DeleteFlag]  DEFAULT (0),
 CONSTRAINT [PK_cfgReport] PRIMARY KEY CLUSTERED 
(
      [ReportID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
      
Thanks, 
-Awaneesh / comments
                        
                        
                        
                      
                      
                        
                          - Community
- SQL Data Compare Previous Versions
- "Invalid Column Name 'MISSING'"- Error while executing block
Hello Brian,
Thanks for your reply.
We got this error while using the Red-Gate toolkit bundle as well as the SQL Datacomapre 5.2. commercial release both. Intially we got the error in the .net code...
                      
                        
                        
                          0 votes