minhphien / migratordotnet

Automatically exported from code.google.com/p/migratordotnet
0 stars 0 forks source link

SQLServer nvarchar(max) #130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. AddColumn with column of type DbType.String and size -1 creates a column 
of type nvarchar(255) in stead of nvarchar(max)

What version of the product are you using? On what operating system? With 
what .NET implementation/version?

OS: Windows 7, .NET 3.5

What database and version are you seeing this issue on?

DB: MSSQL 2005

Original issue reported on code.google.com by jelle.hu...@gmail.com on 23 Oct 2009 at 12:22

GoogleCodeExporter commented 9 years ago
for create columns varchar(max), use DbType.AnsiString type with a length  
int.MaxValue

Original comment by dima117a@gmail.com on 24 Oct 2009 at 5:10

GoogleCodeExporter commented 9 years ago
In order to create an nvarchar(max)column you need to set the size to the 
following 
length: 0x3fffffff.  I presume this is a bug in how the data type is registered 
in the 
SqlServer2005Dialect class as varchar(max) and varbinary(max) are registered 
with sizes 
of 0x7fffffff = int.MaxValue.

Original comment by gmanc...@googlemail.com on 20 Nov 2009 at 10:02

GoogleCodeExporter commented 9 years ago
I couldn't get int.MaxValue for DbType.String to output nvarchar(max), but 
entering 
1073741823 as the length seemed to work. 

Also make sure you change the provider in your Migrate task to SqlServer2005 in 
you're 
using MSBuild

Original comment by jeremyse...@gmail.com on 3 Jun 2010 at 7:33

GoogleCodeExporter commented 9 years ago
Attached is a patch for the fix that gmancoll suggested 

Original comment by edwin.vd...@gmail.com on 29 Dec 2010 at 2:56

Attachments:

GoogleCodeExporter commented 9 years ago
Edwin: Shouldn't that be also against SqlServerDialect.cs, as that has the same 
issue?

Original comment by palfrey on 15 Feb 2011 at 12:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@palf: As far as i know, SQL server 2000 does not support the nvarchar(max) 
datatype. It was introduced in SQL server 2005 if i'm not mistaking.

See:
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
and
http://msdn.microsoft.com/en-us/library/ms176089%28SQL.90%29.aspx
for more information. 

Original comment by edwin.vd...@gmail.com on 15 Feb 2011 at 6:09