Microsoft KB Archive/89938

= BUG: ISQL Problems with PRINT in Stored Procedures =

Article ID: 89938

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition
 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q89938



BUG# NT: 7406 (4.2)



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 &quot;sp_test&quot; as follows:

Create procedure sp_test as  select * from sysdatabases where 1=2 print &quot;End of Procedure&quot;

When sp_test is executed, ISQL produces the following output

  End of Procedure 

The output from ISQL should be:

   (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.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: stored procedure ISQL

Keywords: kbbug KB89938

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.