June 29, 2004 at 4:44 am
I need a SQL parser (with source code) where it takes as input an SQL statement, and parses it and outputs columns, tables, Type of operation(Select,Insert,Delete...).
Someone knows somthing like this in .NET (prefered in VB.NET)
Regards
June 29, 2004 at 6:07 am
what standard of SQL ? ANSI? T-SQL?
what type of output do you want? text file?
why ot just use the isqlw.exe feature of sql server and the -i -o parameters??
MVDBA
June 29, 2004 at 7:44 pm
Thank you for your consideration!
In fact, I would like to validate a SQL statement is inputed by user. For example, if users input a SQL statement from a textbox:" Select product_name, product_type from Products inner join ProductTypes on Products.product_typeid=ProductTypes.product_typeid where Products.product_typeid='1' ", I will validate this statement, so that I parse fields returned (product_name, product_type) I want in my program in VB.NET.
Pls help me!
Thanks a lot
June 30, 2004 at 1:21 am
Uh oh! Please google "sql injection" before you get to far along with your project, the type of application you are proposing is incredibly risky/dangerous.
June 30, 2004 at 3:23 am
all you are doing here is replicating what the SQL server is doing....
if you are using ADO.net then you can send the query and return a recordset.
the ado recordset object can then be queried to find with fields, qty of data etc are returned.
MVDBA
July 1, 2004 at 12:54 am
Like Mike already said, you're trying to reinvent the wheel!
If I were you, I wouldn't waste my time with such a thing.
The other important consideration is also already mentioned: SQL Injection
Read this and decide if that's still the way for you to go. Maybe you decide to go down stored procedures road to have better control.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
July 1, 2004 at 12:56 am
Btw, there is SET PARSEONLY { ON | OFF }. Never used it myself, but might be worth having a look at in BOL.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
July 1, 2004 at 7:51 pm
Hello All!
In fact, I would like to thank, thank all of you. I changed the requirement and performed by another way. Thank you any ways.
Regards
February 28, 2006 at 10:21 am
I too had a developer ask me about validating sql data from an app he wrote that allowed users to input T-SQL statements and the SET PARSEONLY worked out great.
Thanks again for your posting of that info.
Steve
Steve Feichtl
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply