Solved TD-15968: Critical bug on SqlServer

Post found bugs and possible workarounds.
Nils Jänicke
Posts: 423
Joined: 20 Sep 2017, 11:56
Location: Villingen-Schwenningen, Germany

TD-15968: Critical bug on SqlServer

Post by Nils Jänicke » 22 Jul 2011, 09:30

On SqlServer queries of nvarchar(max) declared fields receive two extra bytes in the buffer. So strings cannot be concatenated.

See the example. On SP3 and older the buffer length is always length * 2 + 2 but on EMP5361 the buffer length is length * 2 + 4!!!

Tested on SqlServer 2008 R2

Testcase: Enter the connection informations and
click Connect
click Create Table
Enter a content into the text field at the bottom or leave it blank
click Fill
click query and see that the buffer length is wrong.
You do not have the required permissions to view the files attached to this post.


Re: TD-15968: Critical bug on SqlServer

Post by giscon » 25 Jul 2011, 09:57

With EMP 5361 the problem with long string / nvarchar and wrong buffer length (now two bytes too much) seems to be relevant for nearly all databases.
Only with SqlBase 11.6 it's now o.k., with that version the buffer was earlier too bytes too short.
But with ALL these other databases it's now wrong: SqlBase 11.5, 8.5, SqlServer, Oracle (there even worse, the string is truncated) !

A workaround, only for the two bytes too much (for Oracle I don't know one - besides to go back to e.g. SP2 EMP 5347), could be to correct the buffer after fetching the Long String by such as :

Set sLongString = SalStrLeftX( sLongString, SalStrLength( sLongString ) )

But it can be a lot of work to identify all relevant TD-programs and build it in, we need a new corrected EMP anyway, especially for the Oracle-problem.


Mike Vandine

Re: TD-15968: Critical bug on SqlServer

Post by Mike Vandine » 25 Jul 2011, 15:35

Hi Nils,

I have added your testcase and report of the SQL Server problem to TD-15968.

Best regards,



Re: TD-15968: Critical bug on SqlServer

Post by firstbase107 » 05 Aug 2011, 15:12

Hi There,

we also ran into this issue ... right after we created a new version for our customers and started to deploy!!!!
That gave us some "red heads" here ...

Hope to get a solution for this urgently!

Cheers from Vienna,

Jeff Luther

Re: TD-15968: Critical bug on SqlServer

Post by Jeff Luther » 05 Aug 2011, 21:59

Alex: FYI, I just checked and see that a fix for TD-15968 is scheduled to be released with EMP5363, due out in in a week or so.

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 1 guest