Conflict between Delphi and SQL server

只愿长相守 提交于 2019-12-07 03:01:27
RRUZ

The GO keyword is not a SQL Server statement

GO is not a Transact-SQL statement; it is a command recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code editor.

You must remove this statement from your Delphi Code in order to execute your Sql sentence. check this question for an example How to run a database script file from Delphi?

You cannot do multiple statements in a Delphi query.
Put each block before each go in its own query and run them in sequence.

Then it should work.
Do not put the go statement in the Delphi query, it does go implicitly.

What you are executing is a script where each individual statement is separated with a GOstatement.

  • SSMS knows how to interprete these statements and execute them one at the time.
  • ADO does not know how to interprete these statements.

You could either

  • parse the statement yourself and execute each individual statement with a TADOQuery.
  • place each statement in a TADOQuery object of its own.

From GO(Transact-SQL)

GO is not a Transact-SQL statement; it is a command recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code editor.

SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!