In my Java program, I am trying to execute a bunch of SQL scripts using sqlcmd via getRuntime.exec().
Earlier, I had been using osql this way -
osql -n -S SERVER -U sa -P PASSWORD -q "SET NOCOUNT ON" -i "INPUTSCRIPT.sql"
However, in the case of sqlcmd, the -i and -q switches are mutually exclusive. How do I do this in sqlcmd?
Note:
I'd rather not modify the SQL scripts to include
SET NOCOUNT ONin each file.There's already been a very similar question here. That solution discusses setting environment variables. Is that possible using Java?