Sending Result Sets to the Server (Extended Stored Procedure API)
When sending a result set to Microsoft SQL Server, the extended stored procedure should call the appropriate API as follows:
The srv_sendmsg function may be called in any order before or after all rows (if any) have been sent with srv_sendrow. All messages must be sent to the client before the completion status is sent with srv_senddone.
The srv_sendrow function is called once for each row sent to the client. All rows must be sent to the client before any messages, status values, or completion statuses are sent with srv_sendmsg, the srv_status argument of srv_pfield, or srv_senddone.
Sending a row that has not had all its columns defined with srv_describe causes the application to raise an informational error message and return FAIL to the client. In this case, the row is not sent.