INF: Operating System Commands and Control of Flow in ISQL

Last reviewed: April 25, 1997
Article ID: Q76784

The information in this article applies to:

  - Microsoft SQL Server version 4.2

SUMMARY

ISQL can issue operating system commands by starting a line with two exclamation points (!!) followed by the command. However, these commands are unconditionally run when encountered by ISQL and they cannot take part in the Transact-SQL control-of-flow language.

MORE INFORMATION

For example, if a file called TEST.SQL is created with the following contents

   if 1=2
   !!dir c:\config.sys
   select "One equals two"

then the operating system command specified on the second line will always be run by ISQL, even though the command is apparently inside an IF control-of-flow condition. Note that the SELECT statement is part of the control of flow and will not be run in this case because 1=2 evaluates to FALSE. When running the following

   ISQL /U<login> /P<password> /S<server> /itest.sql

the output that might be returned is:

1> 2>

 The volume label in drive C is GIZMO.
 The Volume Serial Number is 16AA:6729
 Directory of C:\

CONFIG   SYS     2054   9-10-91  11:52a
     1 File(s)   28319744 bytes free
2> 3>


Additional query words: Windows NT
Keywords : kbtool SSrvISQL SSrvProg SSrvTran_SQL SSrvWinNT
Version : 4.2 | 4.2 | 4.2
Platform : MS-DOS OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.