What are all possible first words of SQL statements?

I am creating a UI to be able to execute SQL queries against a SQL Server database, compatible with SQL Server 2008 R2. I need to determine if each statement can return a dataset, or if it just needs to be executed. In Delphi, TADOQuery

consists of either Open

/ Close

for a dataset or ExecSQL

for execution. I need to automatically detect which one to use based on the first word (s) of the SQL statement.

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

+3


source to share


1 answer


This is impossible in a general sense. For example, the name of a stored procedure EXEC, for example, might return a result set or not, depending on how proc is written. There is no way to know if this is one or the other just from the call syntax.



+8


source







All Articles