Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

AX 2009 error: The length of the specified literal string exceeds max limit

When saving a SalesLine, changing only the Name field, the doUpdate method will occasionally throw an error exception:

The length of the specified literal string exceeds max limit.

When the string length of Name is 128 the doUpdate succeeds.
When the string length of Name is 129 the doUpdate fails (but sometimes it succeds if you change the characters).

The Name field has a defined length of 1000 character (nvarchar(1000) in the database).

It fails in the production system, but not in the test system!

Database logging is not enabled. The Database is SQL 2008 R2. AX kernal version: 5.0.1500.5660

Anyone seen this error?
Any hints to resolve?

Upvotes: 0

Views: 2470

Answers (3)

Tom V
Tom V

Reputation: 1496

I have seen this behaviour too. It must be something in combination with the literals as posted by David. Do you use literals or placeholders in your query?

I can perfectly reproduce this in kernel 5.0.1600.2967 (on the salestable).

It has to be a bug with the combination of forceliterals and doUpdate()

Changing the field to data type memo or some other changes like changing the cachelookup didn't help either.

Upvotes: 0

Merlin666
Merlin666

Reputation: 11

Dont use literals in query. I quess in salesLine datasource init method you use literals. Like:

SalesLine_ds.query().literals(true);

Upvotes: 1

AnthonyBlake
AnthonyBlake

Reputation: 2354

It is possible quotename is being used in sql server 2008?

There appears to be an issue with the length restriction being 128 characters in this version of SQL server

http://sqlserverpedia.com/blog/sql-server-bloggers/watchout-when-using-quotename-2/

Upvotes: 0

Related Questions