Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Parser! Expand / Collapse
Author
Message
Posted Tuesday, June 29, 2004 4:44 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 1, 2004 7:35 PM
Points: 3, Visits: 1
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
Post #123540
Posted Tuesday, June 29, 2004 6:07 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 8, 2014 3:25 AM
Points: 2,283, Visits: 781
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
Post #123558
Posted Tuesday, June 29, 2004 7:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 1, 2004 7:35 PM
Points: 3, Visits: 1

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

Post #123760
Posted Wednesday, June 30, 2004 1:21 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, June 3, 2013 9:53 PM
Points: 433, Visits: 619

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.

 




Post #123787
Posted Wednesday, June 30, 2004 3:23 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 8, 2014 3:25 AM
Points: 2,283, Visits: 781
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
Post #123813
Posted Thursday, July 1, 2004 12:54 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, December 9, 2014 5:36 AM
Points: 5,956, Visits: 286
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/
Post #124079
Posted Thursday, July 1, 2004 12:56 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, December 9, 2014 5:36 AM
Points: 5,956, Visits: 286
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/
Post #124080
Posted Thursday, July 1, 2004 7:51 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 1, 2004 7:35 PM
Points: 3, Visits: 1

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

Post #124370
Posted Tuesday, February 28, 2006 10:21 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, December 19, 2014 10:00 AM
Points: 92, Visits: 82

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




Kindest Regards,

Steve Feichtl
Post #262032
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse