开发者

SQL Parsing in C#? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_开发问答

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

in my application , i have a textbox where user can paste Sql (mainly from MS-ACCESS) , i need to parse this SQL and get the table names , joins , Columns etc.

is there a easy in c# rather than using string manupulation to do this activity?

i can think of implementing a BST aslo but don't have any clue where to start?


Irony for C# has an LALR parser with several grammars already created, including one for SQL (as you can see from the screenshot on the home page). It's a very easy to use parser using operator overloads to define the grammars in a way reminiscent to BNF.


I'd suggest ANTLR using SQL Server 2000 grammar as a template.


I've done some work using the gold parser to be able to parse and programatically explore SQL statements. In my case it is SQL 89 which would not include a fair amount of access syntax but may be someone you could build on. http://www.codeproject.com/KB/linq/QueryAnything.aspx

It's still somewhat experimental but the underlying parsing is pretty flexible.


I have had some success using this: https://github.com/jehugaleahsa/SQLGeneration It's free to use, is open source, worth checking out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜