I am altering a column from nvarchar(150) to nvarchar(100) but want to be able to truncate values if they are over 100 length.
Is there any way other than using Execute.Sql() to update rows with using existing column values? I am trying to avoid coupling to a specific DB.
I have looked at
Update.Table("tblName").Set(new {colName = "existing val of colName??"});
but I can't get at the existing value. Is there something like:
Update.Table("tblName")
.Set(tbl => new { colName = tbl.Column("colName").AsString(150).SubString(0, 100) });
What other strategies have people used to avoid the truncation error, "String or binary data would be truncated", when using AlterColumn?