sql command to run sql commands in file

sql command to run sql commands in file

Post by John Dim » Thu, 04 Apr 2002 04:43:45



I'm looking for something like

  exec sql-file=c:\commands.sql

In Oracle, I can create a file to run other files of sql
commands, like this:




Is there something similar in SQL Server?  Maybe a command
line version of the query analyzer?

 
 
 

sql command to run sql commands in file

Post by Allan Mitchel » Thu, 04 Apr 2002 04:55:30


look up osql and the i switch

--

Allan Mitchell
www.allisonmitchell.com


> I'm looking for something like

>   exec sql-file=c:\commands.sql

> In Oracle, I can create a file to run other files of sql
> commands, like this:




> Is there something similar in SQL Server?  Maybe a command
> line version of the query analyzer?


 
 
 

sql command to run sql commands in file

Post by Dan Guzma » Thu, 04 Apr 2002 22:57:48


You can include script files using ':r' as input to the OSQL
command-prompt utility.  For example:

--MyScriptList.txt
:r file1.sql
GO
:r file2.sql
GO
:r file3.sql
GO

--RunMyScriptList.cmd
OSQL -i MyScriptList.txt -S MyServer -E

For details, see the SQL 2000 Books Online
(coprompt.chm::/cp_osql_1wxl.htm).

Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy  Neil Pike):

http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------


> I'm looking for something like

>   exec sql-file=c:\commands.sql

> In Oracle, I can create a file to run other files of sql
> commands, like this:




> Is there something similar in SQL Server?  Maybe a command
> line version of the query analyzer?

 
 
 

1. Install sheild express,run command/run command parameters?

I'm making setup of application by Installshield Express.
There is two steps available for setting working dir:
I. Select user interface components,Dialog boxes,Setup complete
Run command
--------------------------------?
Run command parameters
----------------------------------?
II.Specify the folder and icons,General setting
Run command
--------------------------------?
Run command parameters
--------------------------------?
My script file/staring file is payroll.sdl, i want to set working dir
whatever user selected in setup, i'm giving only paradox runtime with to the
user.I try <installdir>/payroll.sdl, -w <installdir>/payroll.sdl and so many
ways, it is not setting a working dir.
Any one can help me for the above situvation
-Kumar

2. Oracle Books

3. how to run .sql files at unix command line

4. Workstation Install Fails Under PDOXWIN 5.0

5. Running a sql file from a command prompt.

6. DB2 Java Adminstrative API

7. Running a SQL file from OSQL command line utility

8. JDK 1.2 Beta 4 and JDBC

9. Running batches of sql files by a single command

10. Unable to run command prompt SQL Utility from SQL Agent

11. how do run sql from the command line with embedded sql

12. Command-line options for running SQL Query Analyzer (SQL 2000)

13. ! (RUN) Command, DOS Commands, and Windows95