Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I notice that ISQL is able to get the results of running a PRINT command. With other databases you would use a combination of SQLGetDiagRec and SQLGetDiagField to retrieve this information from the database. This doesn't seem to be the case for SQL Anywhere.

How do other tools like ISQL get the results of PRINT commands?


asked 22 Apr '10, 13:31

Brad%20Wery's gravatar image

Brad Wery
accept rate: 0%

edited 22 Apr '10, 14:54

Volker%20Barth's gravatar image

Volker Barth

I do not know how ISQL does handle this, but can use MESSAGE TO CLIENT statements in your SQL code and use a particular callback to receive those messages. I guess (though I'm not sure) it will display the contents of PRINT statements, too. Cf. my answer on your previous question on the similar topic.

You may have a look at SA_REGISTER_MESSAGE_CALLBACK for that usage.

Additionally, you can list the messages displayed on the server console with the sa_server_messages system procedure or the properties Message, MessageTime and MessageText combined with the according line number. AFAIK, this will however list ALL messages for all connections.

As stated, I have used both techniques with MESSAGE statements but are not sure whether they work with PRINT, too.

permanent link

answered 22 Apr '10, 14:53

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

PRINT is the Transact-SQL variant of the MESSAGE statement. Both statements cause a message to be send over the wire to the client outside of the application-level protocol (ie ODBC). If the transport layer doesn't support handling the message, the message is instead displayed on the console window.

permanent link

answered 22 Apr '10, 19:08

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Apr '10, 13:31

question was seen: 3,167 times

last updated: 22 Apr '10, 19:08