{"id":1902,"date":"2017-12-06T10:36:01","date_gmt":"2017-12-06T10:36:01","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1902"},"modified":"2020-01-09T09:42:34","modified_gmt":"2020-01-09T09:42:34","slug":"sql-files-execute-incorrect-syntax-near-go","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/sql-files-execute-incorrect-syntax-near-go\/","title":{"rendered":"SQL files execute : Incorrect syntax near &#8216;go&#8217;."},"content":{"rendered":"<p><strong>saiki created the topic: SQL files execute : Incorrect syntax near &#8216;go&#8217;.<\/strong><br \/>\nGetting below issue when trying to run the ant script.<\/p>\n<p>I am trying to run few sql files from the folder through ant script in which I configured the &#8220;jtds-1.2.5.jar&#8221;.<br \/>\nUnable to run the GO statment in the sql file. But able to execute same file it through sql studio with out any error.<\/p>\n<p>************************************************** **<br \/>\n<target name=\"runscript\"><br \/>\n<sql driver=\"net.sourceforge.jtds.jdbc.Driver\"\nurl=\"jdbc:jtds:sqlserver:\/\/${xxxxx}:${1433}\/;\"\nuserid=\"${aaaaaaaa}\" password=\"${bbbbbb}\"\nclasspathref=\"jtds-1.2.5.jar\">\n<path>\n<fileset file=\"${basedir}\\source\\Mydata.sql\"\/>\n<\/path>\n<\/sql><br \/>\n<\/target><\/p>\n<p>************************************************** **<br \/>\nERROR:<br \/>\n************************************************** **<br \/>\njava.sql.SQLException: Incorrect syntax near &#8216;go&#8217;.<br \/>\nat net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.java:368)<br \/>\nat net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2820)<br \/>\nat net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2258)<br \/>\nat net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(T dsCore.java:632)<br \/>\nat net.sourceforge.jtds.jdbc.JtdsStatement.processRes ults(JtdsStatement.java:584)<br \/>\nat net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL (JtdsStatement.java:546)<br \/>\nat net.sourceforge.jtds.jdbc.JtdsStatement.executeImp l(JtdsStatement.java:723)<br \/>\nat net.sourceforge.jtds.jdbc.JtdsStatement.execute(Jt dsStatement.java:1160)<br \/>\nat org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLE xec.java:775)<br \/>\nat org.apache.tools.ant.taskdefs.SQLExec.runStatement s(SQLExec.java:751)<br \/>\nat org.apache.tools.ant.taskdefs.SQLExec$Transaction. runTransaction(SQLExec.java:1055)<br \/>\nat org.apache.tools.ant.taskdefs.SQLExec$Transaction. access$000(SQLExec.java:985)<br \/>\nat org.apache.tools.ant.taskdefs.SQLExec.execute(SQLE xec.java:653)<\/p>\n<p><strong>rajeshkumar replied the topic: Re: SQL files execute : Incorrect syntax near &#8216;go&#8217;.<\/strong><br \/>\nave you tried executing sql statement on command line. may be sql studio has some setting which is helping to get it execute but not the ant script.<\/p>\n<p>please refer these url as well&#8230;<br \/>\n<a href=\"http:\/\/forums.oracle.com\/forums\/thread.jspa?threadID=1323298\" target=\"_blank\" rel=\"noopener\">forums.oracle.com\/forums\/thread.jspa?threadID=1323298 <\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/6614544\/how-...on-using-jdbc-driver\" target=\"_blank\" rel=\"noopener\">stackoverflow.com\/questions\/6614544\/how-&#8230;on-using-jdbc-driver<\/a><br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>saiki replied the topic: Re: SQL files execute : Incorrect syntax near &#8216;go&#8217;.<\/strong><br \/>\nI Have set delimetr to GO in ant script<\/p>\n<p>Then it worked<\/p>\n","protected":false},"excerpt":{"rendered":"<p>saiki created the topic: SQL files execute : Incorrect syntax near &#8216;go&#8217;. Getting below issue when trying to run the ant script. I am trying to run few sql files&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[12],"tags":[421],"class_list":["post-1902","post","type-post","status-publish","format-standard","hentry","category-apache-ant","tag-sql"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=1902"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1902\/revisions"}],"predecessor-version":[{"id":1903,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1903"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}