Issue 31015  —   Sybase error when trying to insert a TEXT field.

Status:   Solved in 10.2.01

Solution available in patch(es):      X704    G101

Description:

 Summary:
 Sybase error "Incorrect syntax near the keyword 'NULL'" when storing
 a TEXT field.

 Environment:
 +Uniface: Version 9.6.06
 +Operating System: All Windows versions
 +Database: Sybase ASE 15.7 and 16.0

 Symptoms:

 When you have an entity with a SC* field, the Sybase driver maps
 it to a Sybase TEXT field. with some Sybase versions, trying to
 store data in such a field fails with these errors:

   Incorrect syntax near the keyword 'NULL'.
   (SYBASE SQL Server Error=156 Severity=15
    State=2 Line=1)

   ct_send_data(): protocol specific layer: internal Client
   Library error: There is an internal tds layer error. An
   error was returned from the server while processing an
   internal tds stream.
   (Client-Library Error=67241522 Severity=6
    Layer=4 Origin=2)
   CT-LIB error : ct_send_data failed
   (SYB Driver Error = -234)

 This can be reproduced with an enterprise version of
 Sybase ASE 15.7 or 16.0, but not with a developer version
 of the same. The problem did not happen prior to
 version 15.7.

Workaround:

 A possible workaround is to use stored procedures, and modify the INSERT
 procedure for your table to use ' ' instead of NULL for the TEXT columns.
 
 For example change:
 
     create procedure e117441_INSERT
     @insert1 int
     as begin
         insert into e117441 (pk, description)
         values (@insert1, NULL)
     end
 
 into:
 
     create procedure e117441_INSERT
     @insert1 int
     as begin
         insert into e117441 (pk, description)
         values (@insert1, ' ')
     end

Notes: