nathanharcup
MIS
Hi All,
I'm trying to compare data in two databases for all tables, I found the below code which works OK but does not work for text, ntext columns
Below is the code im using
set @SQL = 'SELECT ''' + @table1 + ''' AS TableName, ' + @t1ColumnList +
' FROM ' + @Table1 + ' UNION ALL SELECT ''' + @table2 + ''' As TableName, ' +
@t2ColumnList + ' FROM ' + @Table2
set @SQL = 'SELECT Max(TableName) as TableName, ' + @t1ColumnList +
' FROM (' + @SQL + ') A GROUP BY ' + @t1ColumnList +
' HAVING COUNT(*) = 1'
Is there a way of using UNION ALL with text, ntext ?
Thanks
Nathan
I'm trying to compare data in two databases for all tables, I found the below code which works OK but does not work for text, ntext columns
Below is the code im using
set @SQL = 'SELECT ''' + @table1 + ''' AS TableName, ' + @t1ColumnList +
' FROM ' + @Table1 + ' UNION ALL SELECT ''' + @table2 + ''' As TableName, ' +
@t2ColumnList + ' FROM ' + @Table2
set @SQL = 'SELECT Max(TableName) as TableName, ' + @t1ColumnList +
' FROM (' + @SQL + ') A GROUP BY ' + @t1ColumnList +
' HAVING COUNT(*) = 1'
Is there a way of using UNION ALL with text, ntext ?
Thanks
Nathan