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 语句的所有可能的第一个单词是什么?
基础教程推荐
- 是否可以执行按位分组功能? 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 无法解决整理冲突 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
