开发者

Incorrect syntax near 'GO' - TADOQuery [duplicate]

开发者 https://www.devze.com 2023-03-05 14:32 出处:网络
This question already has answers here: 开发者_如何学C Closed 11 years ago. Possible Duplicate: How to run a database script file from Delphi?
This question already has answers here: 开发者_如何学C Closed 11 years ago.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消