File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Error while calling sqlcmd (sql server 2008 R2) from Java 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Error while calling sqlcmd (sql server 2008 R2) from Java 7" Watch "Error while calling sqlcmd (sql server 2008 R2) from Java 7" New topic
Author

Error while calling sqlcmd (sql server 2008 R2) from Java 7

John Greek
Greenhorn

Joined: Jan 24, 2012
Posts: 1
Hi,

I am facing some error wile executing sqlcmd form java. take a look...

Process process = Runtime.getRuntime().exec("sqlcmd -m-1 -S localhost,1433 -d my_server -U sa -P abc -Q \"select * from Assests where AssetID > 'G123204E4-1234-4A31-B37B-0092D68DA429'\" -k2 -W -h-1 -s\",\" -o \"D://Assests.csv\"");

while running sqlcmd from sqlclient its working fine but form java it giving expression error

Msg 4145, Level 15, State 1, Server SANDIPB-PC, Line 1
An expression of non-boolean type specified in a context where a condition is expected, near 'AssetID'.

and when I change ">" to "=" its working fine.

can any one know why this is happening. Please let me know
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while calling sqlcmd (sql server 2008 R2) from Java 7