SYMPTOMS
The ISQL.EXE utility may behave unexpectedly when a PRINT statement is the
last statement in a stored procedure.
For example, create a stored procedure "sp_test" as follows:
Create procedure sp_test as
select * from sysdatabases where 1=2
print "End of Procedure"
When sp_test is executed, ISQL produces the following output
End of Procedure
<column header for sysdatabases>
The output from ISQL should be:
<column header for sysdatabases>
(0 rows affected)
End of Procedure
This problem occurs only when the stored procedure has a SELECT
statement immediately prior to the PRINT statement and the SELECT
statement does not return any rows.
WORKAROUND
For Microsoft SQL Server 7.0 and above, use OSQL.EXE instead of ISQL.EXE.