tags:

views:

183

answers:

3

I worked on a parser for arithmetic expressions. The key there was building a syntax tree, where leaves are variables and nodes are operators.

Not I'm thinking about parsing SQL queries. Parsing simple select won't be a problem, but I'm not pretty sure about the complex queries. Can you point me to a good reference about sql parsing. Thank you in advance!

+4  A: 

Take a look at the SQL BNF grammars

nos
+1  A: 

Some codesamples: Look at sourceforge Open SQL parser. There was a question for sql parser library before. Look there.

Christian13467
+2  A: 

I'm not sure if you know C# or .NET, but LinqToSql basically does this by building expression trees that are then executed only when the query is 'called'.

Dan Diplo