2

Quick question about running SQLServer scripts from a remote machine using JDBCs. I have a script that starts out as follows:

 USE MASTER
 GO

 IF EXISTS(SELECT * FROM SYS.SYSDATABASES WHERE NAME = 'MockData')
 DROP DATABASE MockData
 GO

 CREATE DATABASE MockData
 GO

 USE MockData
 GO
 ...

On the local machine I log in as my user and if I open this script file and execute it, it runs just fine. However, if I am on a different machine and connect using the Java JDBC driver (logged in as the same user) I get the following exception.

 Error executing: GO 
 com.microsoft.sqlserver.jdbc.SQLServerException: Could not find stored procedure 'GO'.

Does anyone know why this would fail over JDBC but not on the local machine? Thanks

serge
  • 13,940
  • 35
  • 121
  • 205
decal
  • 987
  • 2
  • 14
  • 39
  • 7
    GO is not a SQL command, it is scripting command to separate commands in a query window. – Sparky Jul 26 '13 at 19:40
  • Check this link out: http://stackoverflow.com/questions/2668529/t-sql-go-statement – Sparky Jul 26 '13 at 19:41
  • Sparky, I see what you are saying, but that post says I need to use go when I am dropping and creating things with the same name, like I am trying to do when I drop database MockData and than create it again. – decal Jul 26 '13 at 19:46

0 Answers0