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");

2 Answers 2

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.

3
  • but that configuration resets database everytime?
    – Mert
    Commented Jun 30, 2014 at 9: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
    Commented Jun 30, 2014 at 13:29
  • I will try it out after backup db :)
    – Mert
    Commented Jun 30, 2014 at 14:14
0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.