This error can be a bit of a school boy error. I've only usually bumped into it when I've been in the midst of a content migration phase and using something like uSIteBuilder. When importing text once in a while I'll see the 'Unable to publish - String or binary data would be truncated' when trying to save a page via code.
If you get this error and have a few minutes to look into the database, you'll find the 'CMSPropertyData' table. CMSPropertyData is the table that will store all your properties data.
As you can from the image above, the dataNvarchar field is set to 500 characters max. If you want to store data in a property that uses dataNvarchar you will be limited, the Textstring property, for example, uses this. If you have too much data then I suggest you change the type of property you are using on your document type so it uses the dataNText property instead.
If you do any Googling on this issue, you may see a few people who recommend going into SQL are running a script to enlarge dataNvarchar to use an nvarchar(MAX) type, like so:
[sql 1="ALTER" 2="TABLE" 3="dbo.cmsPropertyData" 4="ALTER" 5="COLUMN" 6="dataNvarchar" 7="nvarchar(max)" 8="[/sql" language="}"][/sql]
DO NOT USE THIS. I've been working with CMS systems for over a decade and one of my main tips I'll tell people is to leave the CMS database alone. Never try to modify it, if it can be avoided, don't even add custom tables to it, as it can make upgrading later a pain. When you work with Umbraco you should always go via the API. In this instance, it's much better to change your property type to use a RichtextEditor instead.
When you try and store data using the RichtextEditor property, your data will be stored within the 'dataNText' column and you can save without any annoying properties!
If you can't simply just delete your property, then it might be easier to add a new RichtextEditor property to your document type and then use the API to copy all your existing data, into it. The code to do this is pretty simple and would look something like this:
var homepage = ApplicationContext.Current.Services.ContentTypeService.GetContentType(DocumentTypeAliasResolver.Homepage);
homepage.NewProeprty = homepage.OldProperty;
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge