Click here to Skip to main content
15,905,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How would I find out if a string is in SQL syntax with out seeing if the command would work?
Posted
Updated 13-Sep-13 10:04am
v2
Comments
RedDk 13-Sep-13 15:43pm    
First a "string" has no syntax to begin with and secondly the tools that aid in your interpretation of what a "command" is are paramount to any discussion of "checking".
shelby67 13-Sep-13 15:47pm    
How would you reword what you believe it is I'm asking? (seriously)
RedDk 13-Sep-13 15:49pm    
phishing, one, two, three ...
shelby67 13-Sep-13 15:58pm    
...?

1 solution

You have two options.

Either execute the SQL statemet against the engine that it's written for or write your own SQL Syntax Parser.

You would, of course, have to write a "pluggable" parser to support the various dialects of SQL that are out there. SQL Server does not understand Oracle, nor is the reverse true. Then there's 4th Dimension, Adabas, Alpha Five, Cassandra, Derby, Altibase, BlackRay, CA-Datacom, Clarion, Clustrix, CSSQL, CUBRID, Daffodil, DataEase, Dataphor, dBase, EnterpriseDB, FileMaker Pro, Firebird, H2, IBM DB2, Lotus Approach, Ingres, Informix, InterBase, Linter, MaxDB, Access, FoxPro, Openbase, Virtuoso, Panorama, PostgreSQL, SQLBase, RDM, SmallSQL, SQLlite, ... Those are just the ones I can remember off the top of my head. There's probably dozens more.

Good luck with that!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900