HomeSQL ServerSQL Server Error Msg 131 – The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d).

SQL Server Error Msg 131 – The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d).

In this blog post, let’s learn about the error message “131 – The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d).” in Microsoft SQL Server, the reason why it appears and the solution to fix it.

SQL Server Error Message

131 – The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d).

Reason for the Error

SQL Server Error Msg 131 occurs when you attempt to store data that exceeds the maximum allowed size for any data type. This error message indicates that the size of the data you are trying to store is larger than the maximum size limit of any data type in SQL Server.

Here’s an example of SQL code that can trigger this error:

CREATE TABLE [dbo].[Books] (
    [BookID]         INT,
    [BookTitle]      VARCHAR(200),
    [BookSummary]    VARCHAR(20000)
)

In this example, the BooksSummary has a Varchar field that exceeds the maximum allowed size of 8000.

SQL Server Error Msg 131 - The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d).

Solution

To fix this error, you can either reduce the size of the data you’re trying to store, or you can increase the maximum allowed size for the data type.

In the above example, either change the size of BookSummary to 8000 or change its data type to VARCHAR(MAX).

Leave A Reply

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

You May Also Like

When dealing with a relational database management system (RDBMS) like SQL Server, compatibility level is an important concept to understand....
In this blog post, let’s learn about the error message “49975 – Unable to load controller client certificate due to...
In this blog post, let’s learn about the error message “49973 – Cannot remove tempdb remote file to local tempdb...