Use
There are three utilities that can be used to execute Transact-SQL statements and stored procedures:
Of these utilities, the SQL Server Query Analyzer is the most frequently used. It has a graphical user interface and is therefore easy to use. In addition it offers quick access to help on the syntax of commands.
isql and osql are command line utilities. They have the advantage that they allow the specification of input and output files for scripts and therefore allow you to automate and schedule the execution of scripts.

Always use osql. The isql utility is included in SQL Server 7.0 for compatibility reasons. It does not support all SQL Server 7.0 features.
Procedure
The SQL Server Query Analyzer
Alternatively, if the Enterprise Manager is not running, you can start the Query Analyzer from the Windows NT Start menu. Choose Programs
® Microsoft SQL Server 7.0 ® Query AnalyzerThe SQL Server Query Analyzer window opens.
The results are displayed in a second pane that appears.

If you need help on the syntax of a statement, simply highlight the keyword and press

A convenient feature allows you to type in several queries on the screen, but only to execute one of them. Simply highlight the statement you wish to execute before choosing the execute icon.
The osql Utility
The osql utility allows you to execute Transact-SQL statements, stored procedures and script files. The utility is started in the command prompt.
To execute a script with the
osql utility enter a command as follows:osql -S<server_name> -d<SAPSID> -Usa -P<password> -i<script_name> -o<output_file>
For details refer to the topic "osql utility" in the MS Books Online.