0

I am trying to set the length for an nvarchar, but no success - it is still nvarchar(255).

I am getting this error; "String or binary data would be truncated.\r\nThe statement has been terminated."

Map(x => x.Text).CustomType("StringClob");
//.Length(4001);
//.CustomSqlType("varchar(max)");
//.Length(10000);
//.WithLengthOf(10000);
//.CustomType("varchar(MAX)");
//.CustomSqlType("ntext");
mc110
  • 2,825
  • 5
  • 20
  • 21
Mert
  • 6,432
  • 6
  • 32
  • 68

2 Answers2

1

Try to use update scheme option in fluent configuration, not to face with such problem again.

As you wrote, you get constraint limitation of ms sql.

irotaev
  • 69
  • 7
  • but that configuration resets database everytime? – Mert Jun 30 '14 at 09:36
  • 1
    No that configuration allow db to update scheme only when your current scheme changed. And it means that even on scheme update you will not loose your data. It is absolutly constraint safty process, otherwise you can't update constraint limitation, as foreign key delete. But it has no need in 99% cases. Good luck :) – irotaev Jun 30 '14 at 13:29
  • I will try it out after backup db :) – Mert Jun 30 '14 at 14:14
0

I solved it by deleting table manually, then .Length(4001); worked.

Mert
  • 6,432
  • 6
  • 32
  • 68