Solved

Running .sql file from shell

Posted on 2001-06-13
4
270 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
  • 2
4 Comments
 
LVL 2

Expert Comment

by:ZhongYu
Comment Utility
Hi

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



 
0
 

Expert Comment

by:vivekkj
Comment Utility

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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now