Possible Duplicate:
How to run a database script file from Delphi?
I have a really long sql script to run with a query, it updates fields, create tables, create procedures, etc. So, there's a lot of the word 'GO' around, otherwise it won't function properly.
On the MSSQL Query the script works perfectly whereas on the ADO Query I get the following:
Incorrect syntax near 'GO'
EDIT: Ok, I think we got it pretty well established that ADO Query will not read the word GO. However, without the word GO my code will not work, procedures must be created in the first line and I have a couple of those thrown around the file. Which is an issue.
The only workaround then would be to create separate queries?
Yes. Remove the GO
- it is not valid SQL.
It is syntax specific to Microsoft SQL utilities - see MSDN.
Signals the end of a batch of Transact-SQL statements to the SQL Server utilities.
(emphasis mine)
Go is a batch terminator, it is not SQL, it is understood by SSMS. Just remove the GO when running from ADO
GO is not a SQL command. It is a batch terminator recognized by SSMS
精彩评论