GO is not a Transact-SQL statement

This week I tripped over the following in the MSDN library:


GO is not a Transact-SQL statement; it is a command recognized by the osql and isql utilities and SQL Query Analyzer.

This is a bit of a pain.

I work on a three tier application that makes heavy use of stored procedures (600 and growing).
 
I have a set of expect scripts that I use to refresh the stored procedures.
These are great – it puts a gui onto the batch files that actually run osql commands.
This takes away a lot of the support issues involved in having people misstype complex commands.

The only problem is the scripts are slow to run. It can take 5 mins to refresh the lot.
This is not really that big a problem – but I am trying to put together a continuous integration server and it would be good if the database could be rebuilt very quickly.

To advance my C# knowledge I have started an ADO.NET app that reads the same batch files and then executes the stored procedures (one per file).

This is where I found the above problem. OleDBCommand objects don’t understand the GO command. It looks like I am going to have to preprocess the script and replace GO with ;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s