Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
I got a requirement on the batch file script but I am new to write the Batch file script.

I hope can anyone will help me out on the requirement.

Here is the requirement.
1) I have Application and Database servers.
2) Batch file run on Application server.
3) connect to Database server.
4) run the query present in the batch file in the table of the particular database in DB server.
5) output should be exported into a .csv(excel) file
6) .csv file should be transferred to App server folder
7) if possible maintain the log in app server on each action.
I tried very much after searching the code in google and i cant..

Can anyone please help me with the batch file code with the above requirement.
Posted

1 solution

Almost anything here is not accessible to batch. You can do it in the batch, but only if you use it to run some applications for database operations, logging, pretty much everything. But if you have to write such applications anyway, it would become quite questionable: why using the batch?

However, it depends on what you call "batch". All of the above is not applicable to the much more powerful batch facility, PowerShell:
http://en.wikipedia.org/wiki/PowerShell[^],
http://technet.microsoft.com/en-US/scriptcenter/dd742419.aspx[^].

PowerShell is really extremely powerful. In brief, roughly speaking, nearly anything you can do with .NET you can do with PowerShell. For example, for database work, you can reference ADO.NET assemblies and use ADO.NET, and so on…

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900