Bug #71728 Data Migration Failure: VARCHAR(-1)
Submitted: 15 Feb 2014 3:30 Modified: 15 Feb 2014 16:09
Reporter: mohan murali Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S1 (Critical)
Version: OS:Windows (8.1 64-bit)
Assigned to: CPU Architecture:Any

[15 Feb 2014 3:30] mohan murali
Description:
Workbench Version - 6.0.9.11421 Build 1170

1. This is a follow up to Bug Report 71253

2. Using Data Migration from Microsoft SQL Server 2012 64-bit

3. Using [Microsoft][SQL Server Native Client 11.0][SQL Server]

4. Here's full error text:

ERROR: `SourceDB`.`MLSQuestion`:SQLExecDirect(SELECT [QKey], CAST([Type] as NVARCHAR(-1)) as [Type], CAST([Question] as NVARCHAR(-1)) as [Question], CAST([Options] as NVARCHAR(-1)) as [Options] FROM [SourceDB].[dbo].[MLSQuestion]): 42000:1102:[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '-'.

`SourceDB`.`MLSQuestion`:Finished copying 0 rows in 0m00s

Applying the patch from the fix for 71253, in the migration wizard, the Microsoft SQL Server disappeared from the source Database System list.

Reinstalling the Workbench, the Sql Server appeared again in the list for source DB selection.

How to repeat:
Data Table

SourceDB Schema:

QKey - int - primary key
Type - VARCHAR(MAX)
Question - VARCHAR(MAX)
Options - VARCHAR(MAX)

CREATE TABLE IF NOT EXISTS `TargetDB`.`MLSQuestion` (
  `QKey` INT NOT NULL,
  `Type` LONGTEXT NULL,
  `Question` LONGTEXT NULL,
  `Options` LONGTEXT NULL,
  PRIMARY KEY (`QKey`));

Suggested fix:
Editing the migration python script with the fix has problems.

Not sure if the fix for 71253 solves the problem, since the datatype in question ia an "int" and not VARCHAR...
[15 Feb 2014 13:11] MySQL Verification Team
Thank you for the bug report. Notice that http://bugs.mysql.com/bug.php?id=71253
has status Verified which isn't fixed so this bug can be considered duplicate/related. Thanks.
[15 Feb 2014 14:13] mohan murali
Please ignore the reference to int field in my bug report.

So, in summary,  changing the script makes the SQL Server disappear from the database system list.
[15 Feb 2014 16:09] MySQL Verification Team
Duplicate of bug http://bugs.mysql.com/bug.php?id=71253.
[28 Mar 2014 18:47] Amersh Kushwaha
i,

I am working on a database migration, but point is how to handle MSSQL varchar(max)  for MySql.

Its showing error   

42000:1102:[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '-'.

Here is the point 

CAST([Contact] as NVARCHAR(-1)) as [Contact]

But how can i solve, Please suggest me.

Thank you.