8

I am trying to insert a value into a column of datatype image in SQL Server. I am getting the following error:

Length of LOB data (70823) to be replicated exceeds configured maximum 65536.  
The statement has been terminated.

The data length is less than 2 MB.

What is the problem?

2
  • I am getting this error in asp.net application.
    – gopal
    May 29, 2009 at 12:57
  • you should mark the answer that has helped you as correct May 12, 2011 at 18:51

3 Answers 3

19

For SQL Server 2005 or earlier you can run:

sp_configure 'max text repl size', 2147483647

For SQL Server 2008 or later you can run:

sp_configure 'max text repl size', -1

The former increases the maximum size allowed, the latter essentially says "remove the limit". Once the maximum size is increased or removed, large LOBs will be able to be replicated.

5
  • Do you happen to know how to fix the same problem when it occurs for columns of type VARBINARY(MAX)? (They're also FILESTREAM if that matters).
    – David Moye
    Oct 14, 2010 at 16:01
  • 1
    How come you do not recommend setting the size option to -1 or no maximum?
    – Nat
    Oct 15, 2010 at 1:42
  • @Nat it looks like -1 only became available as of SQL 2008 (see Brian's comment here: sqlmusings.wordpress.com/2008/09/22/…)
    – JohnLBevan
    Oct 19, 2012 at 22:15
  • Amended my answer to add the -1 case. Oct 23, 2012 at 12:26
  • What if you don't want to change the size though, how do you find the table and column causing the issue?
    – Tom
    Oct 3, 2014 at 8:33
5

Don't forget to run RECONFIGURE after running sp_configure so that your changes can take effect

1

As an alternative, you can configure the max text replication size option via SQL Server Management Studio

Reference: http://msdn.microsoft.com/en-us/library/ms179573.aspx

To configure the max text repl size option
1. In Object Explorer, right-click a server and select Properties.
2. Click the Advanced node.
3. Under Miscellaneous, change the Max Text Replication Size option to the desired value.

I've tested it in SQL Server 2012, but from the previous link you can view the instructions for 2005 and 2008 which are the same.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.