This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I just want a query to run from java using run command
SQL Server should come with a command line utility that lets you run queries against the database. Hopefully that utility will also let you specify that the output should be to a CSV file. Once you figure out the proper query syntax, and can run the query from the command line, place the command line with a Runtime.exec() call.
The CSV formatting is probably what will be the hard part; the utility might not have that as an output option. Which means you will have to output to a text file and run a script against the text file. You will have to wrap all of this within a script which you invoke via exec().
Or perhaps there is such a utility that will output the CSV for you...
(Then again, you might actually be asking for the syntax for the command line utility, in which case my response hasn't helped any...)
harikumar meda wrote:Jan Cumps what is your JDBC forum?
The JDBC forum (this forum) is the location on JavaRanch where we discuss JDBC and SQL related issues.
The JavaRanch has forums for several types of discussions. Depending on the type of question you have, you select the correct forum, and post your question there.