What are all the possible first-words of SQL statements?

偶尔善良 提交于 2019-12-02 01:13:08

问题


I'm building a user interface to be able to execute SQL statements on a SQL Server database, compatibility at SQL Server 2008 R2. I need to be able to determine whether each statement could possibly return a dataset, or if it just needs to be executed. In Delphi, the TADOQuery consists of either Open / Close for a dataset, or ExecSQL just to execute. I need to automatically determine which one to use based on the first word(s) of the SQL statement.

How can I determine which method I should call based on the first word(s) in the statement? I would need to know each possible word, and which method based on each word.


回答1:


That is not possible in the general sense. EXEC stored-procedure-name for example can eithers return a result set or not, depending on how the proc is written. There is no way to know if it's one or the other just from the syntax of the call.



来源:https://stackoverflow.com/questions/14927761/what-are-all-the-possible-first-words-of-sql-statements

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