Solved

Running .sql file from shell

Posted on 2001-06-13
4
277 Views
Last Modified: 2006-11-17
Hi
How can i run a .sql file from a shell(dos prompt)
Thanks
0
Comment
Question by:Dishank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:ZhongYu
ID: 6185175
Hi

You can use isql or osql. Please check with online book for detail.



 
0
 

Expert Comment

by:vivekkj
ID: 6189913

like if seervername is "servername"
sql server login is "sa"
password is "password"
database is "databasename"
and your .sql file name is "test.sql"

Go to command prompt and type
 osql -Sservername -Usa -Ppassword -itest.sql -ddatabasename

This will execute whatever is there in your .sql file.

0
 

Accepted Solution

by:
vivekkj earned 25 total points
ID: 6189915
like if seervername is "servername"
sql server login is "sa"
password is "password"
database is "databasename"
and your .sql file name is "test.sql"

Go to command prompt and type
osql -Sservername -Usa -Ppassword -itest.sql -ddatabasename

This will execute whatever is there in your .sql file.

0
 

Author Comment

by:Dishank
ID: 6193950
Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question