0

I am making a tweak to my table.

The scaffold is pretty straight forward, it's limiting the number of characters for some string columns.

I am presented with this error

String or binary data would be truncated in table '', column 'DetailedDescription'. Truncated value: ''

I tried to do an update-database -force and it still won't let me

Migration Details

AddColumn("dbo.Tests", "AdditionalInstructions", c => c.String(maxLength: 2000));
AlterColumn("dbo.Tests", "DetailedDescription", c => c.String(maxLength: 500));
AlterColumn("dbo.Tests", "VenueName", c => c.String(maxLength: 100));

1 Answer 1

1

If you are applying a migration on an existing table that has some rows, the "String or binary data would be truncated in table" error means currently you have a stored string in the "DetailedDescription" column which its length is more than 500 characters. So, you should handle these values and try to run the update-database command again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.