If got an issue with message command (as well as print) on SQLAnywhere.

When running message as a single command it appears that it's completely put everything where it should be.

But when using it inside a procedure for e.g. debugging output of dynamic SQL it appears, that it is truncated at about 300 characters.

  • When you say "appears" - is this in the engine console, the ISQL Messages window or in your application? According to the docs for v12, the message size is limited to the database page size, so something else is truncating it.
    – Justin W
    Aug 27, 2014 at 13:09
  • If you are using MESSAGE TO CLIENT further truncation may happen: A MESSAGE...TO CLIENT expression can be truncated to 2048 bytes. For messages sent with the IMMEDIATE clause, the message expression can be truncated to the smaller of the packet size of the connection or 2048 bytes.
    – Justin W
    Aug 27, 2014 at 13:16
  • At thie procedure it's just happening everywhere. So console as well as (isql) client.
    – frlan
    Aug 27, 2014 at 13:26

1 Answer 1


I found a solution at least for my basic issue, which is almost too simple:

    -- ... some code
DECLARE @generatedProcedureCall LONG VARCHAR
SET @generatedProcedureCall = ... contents
SELECT @generatedProcedureCall

This is allowing me to print out >4k characters for e.g. debugging.

When writing to file e.g.

SELECT @generatedProcedureCall INTO #logfoo
UNLOAD #logfoo to 'some/file'

could do the trick.

Maybe not the cleanest one, but as mentioned it solved at least my issue.

The reasons seems to be, that print as well as message cannot handle string >4k of text. print was just failing with an error whereas message catted my string to 255 characters.

Your Answer

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

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