0

Is there any way to count identifiers of SQL Stored Procedures and/or functions?

This identifiers can be: SELECT, UPDATE, DELETE, IF, While or other SQL Expression.

An identifier is the minimum unit of separation of the SQL interpreter and from what I understand there is no “public” way to count it...

João Costa
  • 33
  • 1
  • 6
  • 3
    Those aren't identifiers. Those are SQL keywords. Your question is really unclear. – Gordon Linoff Mar 25 '21 at 15:27
  • 1
    In SQL, identifiers are object names. E.g. table or column names. – jarlh Mar 25 '21 at 15:29
  • Do you mean "statements"? Any answer depends in part on the dialect of SQL — which DBMS are you interested in? The answer to "how many statements are there in a given stored procedure" is not one for which there is a standard answer. Indeed, most DBMS won't provide the answer easily — it isn't an important statistic to the DBMS. So it is likely you'll end up with code to parse the dialect(s) of SQL you work with. – Jonathan Leffler Mar 25 '21 at 15:30
  • Note, too, that a single SELECT statement might have multiple CTEs (common table expressions, aka WITH clauses), each of which contains one or more SELECT statements, and the main SELECT body might well contain multiple occurrences of SELECT; it probably isn't as simple as counting the keywords. – Jonathan Leffler Mar 25 '21 at 15:33
  • 1
    [Why should I tag my DBMS](https://meta.stackoverflow.com/questions/388759/) –  Mar 25 '21 at 15:36

0 Answers0