SQL Error 8152 SQLSTATE 22001

Apparently, there are some common errors that you may get on your Windows PC. One of them is SQL Error 8152. As a Windows user, you should know more regarding the SQL Error 8152. What is the Error 8152? What cause of the SQL error 8152? and how to fix the error? Find out that information here.


Based on the research, the SQL Error 8152 is well known as the String or Binary Data would be truncated error. Actually, it is one of common errors. You have to know that the SQL Error 8152 usually occurs when a user tries to insert any data in string such as char,nchar, varchar, or nvarchar more than the size of the column. 

For this case, a user needs to check the data size with respect to the column width and identify which column is making the error and then fix it.


Apparently, the SQL Error 8152 error occurs when the value insisted in a field is bigger than the one the database column max value allows. For instance, if there is a simple text field which by default generates a 257 max char column in the database, the error is going to be thrown if entering in this field 258+ characters.


We are able to say that the SQL Error 8152 occurs when C#(model) try to save data records for columns whose size is defined less in SQL SERVER database table where the value to pass to this column string length in bigger. To fix the SQL error 8152 you have to change column of the table in SQL SERVER database by using SQL Server script. You only need to increase the size of the column in table works. Do not need to remove the application in the test environment.

In fact, it is easy enough if you are dealing with less columns in a table. However, it is going to become a nightmare if you are dealing with insert into a query with a big number of columns. It means that you need to check one by one column. 

We get information that there is a shortcut to fix the SQL Error 8152 and provide the column name along with the data making error. We started looking for the solution, but we could not get a correct one. Therefore, we started making the following solution.

Before doing with the solution, you would like to make a simple sample to demonstrate the error. After that, you have to look at the column and see its size.

To fix the SQL Error 8152, you are able to follow these easy steps below:

  • Firstly, you need to pass the string value less than or equal to its size.
  • If you want to compress the error, you have to set the ansi warnings parameter to off.
  • If you use the ansi_warnings parameter as off, then the SQL Error 8152 will be compressed and whatever is able to suitable in the column.
  • The string test is going to be save in your table. Now, it will not get back any error.

Apparently, The error message does not contain adequate information about which is the field length value is making the error. To determine which field value which is making the error, you need to improve the data which is entered when you are making the content. 

Aside from that, you also need to trim out the values of the fields one by one until the saving of the content passed successfully. If the error happens for the made through the backend, you will be able to go through the field inputs and remove the values one by one and then perform the saving operation after each deletion until the saving is successful. 

But, if the error happens for the items made through the API, you have to go through the values received as an input or static values that were set in the code and then perform the same process of deleting values one by one.

Please understand what text field of the document contains the long string that prevents the document publish refer to the file DocumentExtractor.zip. You have to know that it contains a webform with Sitefinity API that will report on the length of the string properties of the document and show them to the user. 

Doing this way, easily it will be able to be determine which field contains many symbols. Now, we are going to explain how to use the DocumentExtractor. Apparently, there are some easy steps that you have to do in using the DocumentExtractor.

  • At the first step, you have to add it to the website files. Remember that it does not need compilation. In this case, you only need to add it and then use it directly by requesting it via URL.
  • The second step that you have to do is to log in to Sitefinity with a user who has permissions to manage the documents.
  • Now, you have to fill in the textbox with the name of the Document Library where this document is. For note: If the document is in subfolders under the top library do not care about those, the top level library is enough.
  • The next step is to fill in the textbox for the document Title and the language in which the error happens. If the site does not utilize multiple languages (in case it has only the default language EN), so you are able to let us know and try later.
  • Now, the form will output the details for the document and its text properties as well their length.

Well, this is an explanation regarding what the SQL Error 8152 is, what cause of the SQL error 8152, and how to fix the SQL Error 8152. When you get this SQL Error 8152, do not hesitate to try doing those steps above. Make sure that you perform steps by steps completely so that the error will be fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *