I need to compare two ddl, for the same table and identify the changes:
- new column
- deleted column
- datatype change
for example DDL_1 is
column_1 int
column_2 char(10)
column_3 char(20)
DDL_2 is
column_1 int
column_3 char(40)
column_4 int
so:
column_2 deleted
column_4 added
column_3 datatype change
and I need to obtain 3 files: deleted
, added
, changed
if I use
comm -23 DDL_1 DDL_2 > deleted
I would get column_2 (delete) but also column_3
comm -13 DDL_1 DDL_2 > added
I would get column_4 (add) but also column_3
how can I get the correct output?
many thanks
sergio
awk
to the rescue!