What are all the possible first-words of SQL statements?(SQL 语句的所有可能的第一个单词是什么?)
问题描述
我正在构建一个用户界面,以便能够在 SQL Server 数据库上执行 SQL 语句,与 SQL Server 2008 R2 兼容.我需要能够确定每个语句是否可能返回一个数据集,或者它是否只需要执行.在 Delphi 中,TADOQuery
由数据集的 Open
/Close
或仅用于执行的 ExecSQL
组成.我需要根据 SQL 语句的第一个单词自动确定使用哪个.
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 Delp 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.
推荐答案
这在一般意义上是不可能的.例如,EXEC 存储过程名称可以返回结果集或不返回结果集,具体取决于 proc 的编写方式.仅从调用的语法无法知道是其中一个还是另一个.
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.
这篇关于SQL 语句的所有可能的第一个单词是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL 语句的所有可能的第一个单词是什么?


基础教程推荐
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01