Wyszukaj w bazie

corrupt strings on template prints in V2 under sybase 8

Hint Ref: 020701100011
Hint Date: 10/01/2007

Hint Details:

EFFECTED VERSION: 2.0.1.26 
PRIORITY: 1/2/3/4/5     (1=Highest, 5=Lowest)
DETAILS:

 

Problem:

A user had a contract template which worked fine in V1, but which when converted to V2, printed rubbish at the end of some DBText fields. This rubbish often appeared to be part of the original template code.

If the template was in the designer and this was switched to the Preview tab, the template displayed correctly, but did not display correctly when selecting a contract to print.

Note: It was noted that the problem did not appear if the client was connecting to the Sybase 8 database using a Sybase 7 client.  Also, the issue only appeared to affect LONG VARCHARs such as database functions to return addresses and SQL 'list' command etc.

Also, if the sub-selects were taken out of the query or placed above the affected fields in the select list, sometimes this would also sort the problem.

Solution:  The simplest solution appears to be to surround the affected SQL in a 'cast as char' statement, being careful not to make the char to short, or too long (which causes the issue again).

Thus a sub-query

(select list(unitnumbner) from  unit join subcontract where sucbontract.contractid=contid) as ulist,

should be replaced with

cast((select list(unitnumbner) from  unit join subcontract where sucbontract.contractid=contid) as char(100)) as ulist,