Do you know where can I get the BNF (Backus Naur Form) notation for the latest version of T-SQL from. This is the microsoft version and I can't find anything for it. I found SQL2 The revised ISO standard here also called SQL92 but it seems to lack some features of microsoft's T-SQL
-
I don't believe that there is a published BNF for T-SQL. – Damien_The_Unbeliever Jan 31 '12 at 18:27
-
Perhaps if you revised your question to why you wanted such a thing/what problem you were seeking to solve, it could be achieved without? – Damien_The_Unbeliever Jan 31 '12 at 19:35
-
I'm developing something like intellisense for T-SQL (like RedGate's SQL Prompt). That's why I need the BNF notation in order to know what is the next available cosntruct/keyword. – Mihail Shishkov Jan 31 '12 at 21:31
4 Answers
Have you checked out this btw?
They have enginered the notation from the ground up....

- 442
- 4
- 16
I developed TSql grammar for ANTLR 4 in EBNF form. Check it in official grammars repository. It based on msdn description.
Currently implemented syntax:
- Control of Flow (MSDN).
- Cursors (MSDN).
Data manipulation language (DML):
- Expressions (MSDN).
- Predicates.
- Transactions (MSDN).
And another syntax. Check grammar and test files for more detail.

- 4,413
- 8
- 45
- 80
I know this is an old question, but I just found this grammar file hosted on bitbucket that can be used with GOLD Parsing System.
Since you're looking for TSQL's BNF (I was too), and it doesn't really exist, this grammar is the next best thing IMO.

- 134
- 8
SQL Server 2005 is based on SQL-92 with some SQL-99 features and Microsoft's T-SQL extensions. Best I have found currently.
Let me know if you find a more up to date one.....

- 442
- 4
- 16
-
1Microsoft uses [brackets](http://stackoverflow.com/q/9719869/402322) to quote identifiers. This is far away from SQL-92. – ceving Dec 07 '12 at 17:33