473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

executing querys from a batch file

Someone asked me a curious question.

Can I execute a query to sql server from a bat file? how?

If not is there a simple scripting laguage that this person might use to
drive his process that is similar to a dos bat file?
Aug 10 '05 #1
5 9383
William Kossack (ko******@njc.org) writes:
Someone asked me a curious question.

Can I execute a query to sql server from a bat file? how?

If not is there a simple scripting laguage that this person might use to
drive his process that is similar to a dos bat file?


You can use the command-line tool OSQL for this.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Aug 10 '05 #2
Can you point me to an example or somewhere to look online?

Erland Sommarskog wrote:
William Kossack (ko******@njc.org) writes:

Someone asked me a curious question.

Can I execute a query to sql server from a bat file? how?

If not is there a simple scripting laguage that this person might use to
drive his process that is similar to a dos bat file?


You can use the command-line tool OSQL for this.


Aug 10 '05 #3
http://msdn.microsoft.com/library/de...ta_01_5zxi.asp

--
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mi**@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"William Kossack" <ko******@njc.org> wrote in message
news:11*************@corp.supernews.com...
Can you point me to an example or somewhere to look online?

Erland Sommarskog wrote:
William Kossack (ko******@njc.org) writes:
Someone asked me a curious question.
Can I execute a query to sql server from a bat file? how?

If not is there a simple scripting laguage that this person might use to
drive his process that is similar to a dos bat file?


You can use the command-line tool OSQL for this.

Aug 10 '05 #4
and
http://msdn.microsoft.com/library/de...ta_01_2q61.asp

--
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mi**@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"William Kossack" <ko******@njc.org> wrote in message
news:11*************@corp.supernews.com...
Can you point me to an example or somewhere to look online?

Erland Sommarskog wrote:
William Kossack (ko******@njc.org) writes:
Someone asked me a curious question.
Can I execute a query to sql server from a bat file? how?

If not is there a simple scripting laguage that this person might use to
drive his process that is similar to a dos bat file?


You can use the command-line tool OSQL for this.

Aug 10 '05 #5
For an example how to embed a SQL script within a batch script so that you end up with only one file look here:

http://dostips.cmdtips.com/DtCodeInterfacing.php
May 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jean-Marc Molina | last post by:
Hello, I can't find a way to execute a Windows application, whose directory path contains blank spaces, from a PHP script. I also wonder if the problem happens under Linux and other OS. ...
2
by: Sinex | last post by:
Hi, I am triggering a batch file from my C# code. There are no echo commands in the batch file...yet the console window/command prompt window pops up every time the batch file is triggerred. Is...
2
by: Pratibha | last post by:
Hi, I want to execute commands through .NET. Using process, i can execute them in WindowsApplication but the process doesn't work in WebApplication. I am executing a batch file which contains...
7
by: David R. | last post by:
Hello all, I would like to generate a Sql-Script-File and a Batch-File to execute the Batch-File over C#-Code and use the SQL-File as an Input-File for the command "osql" in the Batch-File. I...
0
by: =?Utf-8?B?Vmlua2k=?= | last post by:
hello Everyone, I created this batch file that executes the taskKill command to kill the process on the remote server. When I call this batch file from the console applications, it runs fine and...
3
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
0
by: hi4murali | last post by:
Facing a strange error in MS SQL Management Studio 2005, when trying to open a new query window, open a table to view data or even run and existing SQL query file. The error text is: An error...
2
by: RaviRajhulk | last post by:
I have tried executing executing a batch file from a perl code using system("start c:\\temp\\sample.bat") but it is not executing ,Is there any way to execute batch file from a perl code
4
by: K Viltersten | last post by:
I want to execute a BAT-file as follows. string dir = "c:\\temp\\"; string file = "batch.bat"; TheYetUnknownMethod(dir + file); In Perl, for instance, i can call system() with that string....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.