9

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

Mihail Shishkov
  • 14,129
  • 7
  • 48
  • 59

4 Answers4

5

Have you checked out this btw?

General Sql Parser

They have enginered the notation from the ground up....

dandcg
  • 442
  • 4
  • 16
5

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.

Ivan Kochurkin
  • 4,413
  • 8
  • 45
  • 80
3

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.

EnergyWasRaw
  • 134
  • 8
1

SQL-92 in BNF

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.....

dandcg
  • 442
  • 4
  • 16
  • 1
    Microsoft 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