SQLAnywhere Message Length – Configuring Output Length in isql

sybase-sql-anywhere

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.

Best Answer

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.