Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
John Greek
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic