println("  DECLARE @tablename nvarchar(60), @constraintname nvarchar(60)");
println("  DECLARE @tablename nvarchar(256), @constraintname nvarchar(256)");
    protected void processColumnChange(Table  sourceTable,                                       Table  targetTable,                                       Column sourceColumn,                                       Column targetColumn) throws IOException    {        boolean hasDefault       = sourceColumn.getParsedDefaultValue() != null;        boolean shallHaveDefault = targetColumn.getParsedDefaultValue() != null;        String  newDefault       = targetColumn.getDefaultValue();        // Sql Server does not like it if there is a default spec in the ALTER TABLE ALTER COLUMN        // statement; thus we have to change the default manually        if (newDefault != null)        {            targetColumn.setDefaultValue(null);        }        if (hasDefault)        {            // we're dropping the old default            String tableName  = getTableName(sourceTable);            String columnName = getColumnName(sourceColumn);            println("BEGIN");            println("  DECLARE @tablename nvarchar(60), @constraintname nvarchar(60)");            println("  DECLARE refcursor CURSOR FOR");            println("  SELECT object_name(objs.parent_obj) tablename, objs.name constraintname");            println("    FROM sysobjects objs JOIN sysconstraints cons ON objs.id = cons.constid");            println("    WHERE objs.xtype = 'D' AND");            print("          cons.colid = (SELECT colid FROM syscolumns WHERE id = object_id(");            printAlwaysSingleQuotedIdentifier(tableName);            print(") AND name = ");            printAlwaysSingleQuotedIdentifier(columnName);            println(") AND");            print("          object_name(objs.parent_obj) = ");            printAlwaysSingleQuotedIdentifier(tableName);            println("  OPEN refcursor");            println("  FETCH NEXT FROM refcursor INTO @tablename, @constraintname");            println("  WHILE @@FETCH_STATUS = 0");            println("    BEGIN");            println("      EXEC ('ALTER TABLE '+@tablename+' DROP CONSTRAINT '+@constraintname)");            println("      FETCH NEXT FROM refcursor INTO @tablename, @constraintname");            println("    END");            println("  CLOSE refcursor");            println("  DEALLOCATE refcursor");            print("END");            printEndOfStatement();        }        print("ALTER TABLE ");        printlnIdentifier(getTableName(sourceTable));        printIndent();        print("ALTER COLUMN ");        writeColumn(sourceTable, targetColumn);        printEndOfStatement();        if (shallHaveDefault)        {            targetColumn.setDefaultValue(newDefault);            // if the column shall have a default, then we have to add it as a constraint            print("ALTER TABLE ");            printlnIdentifier(getTableName(sourceTable));            printIndent();            print("ADD CONSTRAINT ");            printIdentifier(getConstraintName("DF", sourceTable, sourceColumn.getName(), null));            writeColumnDefaultValueStmt(sourceTable, targetColumn);            print(" FOR ");            printIdentifier(getColumnName(sourceColumn));            printEndOfStatement();        }    }