=== modified file 'modules/db.mssql/db_mssql_migration_grt.py' --- modules/db.mssql/db_mssql_migration_grt.py 2013-08-27 22:37:54 +0000 +++ modules/db.mssql/db_mssql_migration_grt.py 2014-02-12 18:33:56 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -216,7 +216,10 @@ target_datatype = '' if source_datatype in ['VARCHAR', 'NVARCHAR']: if source_datatype == 'VARCHAR': - type_cast_expression = "CAST(? as NVARCHAR(%d))" % target_column.length + if target_column.length > 4000 or target_column.length == -1: + type_cast_expression = "CAST(? as NVARCHAR(MAX))" + else: + type_cast_expression = "CAST(? as NVARCHAR(%d))" % target_column.length if source_column.length == -1: # VARCHAR(MAX) or NVARCHAR(MAX) target_datatype = 'LONGTEXT' #TODO: Give the user the choice for this target datatype elif 0 < source_column.length < 256: