1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| select table_name, column_name, 'Modifiee'
from information_schema.columns as d1
where not exists(select * from synerglass.information_schema.columns as d2
where d1.table_name = d2.table_name
and d1.column_name = d2.column_name
and isnull(d1.column_default,'') = isnull(d2.column_default,'')
and d1.is_nullable = d2.is_nullable
and d1.data_type = d2.data_type
and isnull(d1.character_maximum_length,0) = isnull(d2.character_maximum_length,0))
and exists(select * from synerglass.information_schema.columns as d2
where d1.table_name = d2.table_name
and d1.column_name = d2.column_name )
union all
select table_name, column_name, 'Ajoutée'
from information_schema.columns as d1
where not exists(select * from synerglass.information_schema.columns as d2
where d1.table_name = d2.table_name
and d1.column_name = d2.column_name)
union all
select table_name, column_name, 'Supprimée'
from synerglass.information_schema.columns as d1
where not exists(select * from information_schema.columns as d2
where d1.table_name = d2.table_name
and d1.column_name = d2.column_name) |
Partager