SQL Server allows you to batch several SQL commands together in a buffer and submit them as a unit. The ESL SQL Executable uses a statement terminator, which your application may set, to determine when to submit the command buffer to SQL Server. When the ESL Executable receives the statement terminator, all commands that have been received since the last statement terminator are executed as a batch.
When commands are batched together this way, the batch should contain only valid TRANSACT-SQL commands. Local commands (those described in this document for controlling the application's behavior) cannot be embedded between the SQL commands. In other words, local commands must be delimited by the statement terminator. For example, the following ESL statement will produce an error (assuming the default statement terminator, which is a newline):
send "select * from titles prompt PROMPT: \n" to SQL
The \n sequence is the statement terminator, but the string being sent to the application contains two commands: a SQL select statement and a local prompt command. These statements must be sent separately, with a statement terminator between them, as follows:
send "select * from titles\nprompt PROMPT: \n" to SQL
When execution of a command batch can produce more than one set of result rows, a prompt is issued in between each result row set. This allows the ESL program to distinguish between the last row of the previous statement and the first row of the next statement. In other words, the results are written exactly as if the individual statements had been issued separately. This is true even if the statements that produced the rows are contained within a stored procedure.
If you want to transfer data with embedded newlines, use terminator command to override the default newline terminator. See the description of the terminator command for information on how to change the default statement terminator.