parsing SQL statement

Anyone having suggestion parsing SQL statement?

It should able to parse:


  'abcd efg',,999, 'some \"STRING\" and \'STR2\' STR3',,,, 'abcd, def, fghi'

I'm using tr and then split by "," but it will fall when seeing comma
inside the single quote.


5/30/2008 12:24:07 PM
perl.beginners 29378 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 41

On Fri, 2008-05-30 at 19:24 +0700, beast wrote:
> Anyone having suggestion parsing SQL statement?
> It should able to parse:
>   'abcd efg',,999, 'some \"STRING\" and \'STR2\' STR3',,,, 'abcd, def, fghi'
> )
> I'm using tr and then split by "," but it will fall when seeing comma
> inside the single quote.

I'm actually about to look into a SQL parsing solution myself.  There
appear to be several modules on CPAN which should be at least a good
place to start.  

> Thanks.
> --budhi

5/30/2008 12:53:10 PM

Similar Artilces:

RE: SQL::Statement cannot parse valid Postgresql statement
> From: Terrence Brannon [] > > On Monday, December 10, 2001, at 09:16 AM, Jeff Zucker wrote: > > > Terrence Brannon wrote: > >> > >> The following SQL is not parseable by SQL::Statement: > >> > >> INSERT > >> INTO thot_log (thot_fk,thot_type_fk,thot_temporality_fk,date) > >> VALUES (?,?,?,CURRENT_TIMESTAMP) > > What I have is a program which reads a SQL statement from a file. > It parses it with SQL::Statement, then it prepares this > statement, then does an ...

Parsing SQL Statements
Has anyone run across any code or utilities for getting information from complex SQL statements? I want to be able to collect the table names and column names from SQL statements with complex sub-queries. Any help or pointers would be appreciated. joe white Joe -- Check out n_cst_sql in the PFC. It has a function that will break up a sql command into individual components (select,from,where,order,...) and another that will recombine the components into a single command. One caveat about this. When I used the 5.0.3 version, it had problems where nested sele...

sql statement parsing
hi guys, how can i parse the where clause in an SQL::Statement object instance? $statement = SQL::Statement->new("select 1,2,3 from table where x=y"); now when i do this: $where = $stmt->where(); it gives me error: Can't locate object method "where" via package "SQL::Statement" (perhaps you for got to load "SQL::Statement"?) at blah line 34. any idea? thanks -- Hytham Shehab At 07:34 PM 8/10/02 +0300, Hytham Shehab wrote: > how can i parse the where clause in an SQL::Statement object instance? >$statement = S...

SQL statement and If statement
I've problem, it's in sqlcommand it's in "where" condition, which if it's exist in sql the "ELSE" not work, and if the condition not in sqlcommand the "ELSE" appear, could someone help  it's in selectcommand.CommandText = "SELECT Weekno FROM Weeks where Weekno='" + Weekno.Text + "'" if i delete the condition the " ELSE " appear. otherwise it's not appear whole code Dim myconnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\football.mdf;Integrated S...

wrong parsing SQL statements
This is a multi-part message in MIME format. ------=_NextPart_000_000A_01C2A5ED.5D254130 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable I have a complex SQL Statements like this: SELECT pms_list_temp.lot_no, pms_list_temp.wo_no, =20 pms_list_temp.seq, =20 pms_list_temp.ord_seq2, pms_list_temp.m_itemno, pms_list_temp.delivery_name,=20 pms_list_temp.dep_no, pms_list_temp.wo_qty, pms_list_temp.dship, pms_list_temp.work_center, =20 pms_list_temp.work_group, pms_list_temp.catch_date, pms_l...

sql statement help (beginner :~) )
Here is what my current SQL statement looks like: SELECT Customers.* FROM Customers INNER JOIN CustomerCatalogs ON Customers.CustomerID = CustomerCatalogs.CustomerID WHERE (CustomerCatalogs.CatalogID = @catID) ORDER BY Customers.CompanyName There’s also a field called “NumbSend” in CustomerCatalogs. NumbSend is the number of catalogs of this type to send with this customer. So CustomerCatalogs contains: CatalogID CustomerID NumbSend Where customerID is the customer’s ID, catalogID is the catalogs ID, and NumbSend is the...

Parsing columns from a sql statement
Hi, How I could get the name of the columns from a string variable that has a sql statement? "select this, that, (to_date('02-02-04','mm-dd-yy')) from table" I want to obtain the column names "this", "that" and (to_date('02-02-04','mm-dd-yy')) Thank you I would suggest to use the POS and MID functions. Joseph wrote: > Hi, How I could get the name of the columns from a string > variable that has a sql statement? > > "select this, that, (to_date('02-02-04','mm-dd-yy')) from >...

Showing parsed SQL statement?
In classic ASP, I used to be able to do a response.write(SQL) to view a parsed SQL statement. Can I do this in .NET? I'm using a SQLDataSource container and want to see what I'm passing through in my INSERT statement. All I can seem to get are @parameters.Thanks!Stace Add OnInserting="SqlDataSource1_Inserting"  to your SqlDataSource and check the InsertCommand and parameter values as shown below. Another way is to use SQL Profiler from SSMS (SQL Server Management Studio) to trace what has been passed to SQL Server.  protected void SqlDataSource1_Inserting(objec...

Parsing complex datawindow SQL statements
Hello, I need to modify the where clause of a datawindow SQL expression at runtime. This cannot be done by using the using retrieval arguments, so I need to modify the TABLE.SELECT of the datawindow. In PFC there is a user object that does this, but it doens't handle the nested queries in the SELECT or WHERE clause. I have been looking around on the internet for hints that point me in the right direction, but I haven't found anything yet. Dipesh Panchal has posted a reply back in december 98 stating that he has done this, but there is no sample code nor details about the way...

PARSE SQL STATEMENT (Changing Where part)
Dear All, I wonder if there is a way to change the Where statement of a Sql statement withouth writing a custom code? For instance I need to change the "select * from employees where serial>100 order by serial" to "select * from employees where EmploymentDate is not null order by serial" Thanks a lot Aref K. Hi, Have that portion of "where ...." in a variable and then you can concatenate it to the query string. Like as follows:- Dim strWhrCon as string // then you can assign the where condition to this variable. strsql =...

Beginners help with Sql Select Statement.
Hi one and all. I apologise in advance for this question, I have searched and searched and have almost gone boss eyed looking at example after example that make no sense to me.I've been tasked with sorting out effectively a SQL frontend. I got Visual Web Developer express and set about trying to learn "on the fly" but have come unstuck quickly!!! The main crux of the headache is SQL Select statements. The side pane of the site has a number of different "searches" avaliable to the user (radio button list). There is a standard search whereby it returns all fro...

Parsing a textbox for use in a SQL statement
How can I take the value of a textbox and parse out the indivdual words to use in a WHERE statement without having to result to having the user placing a special charater in between word?  I'm pulling the text out and doing the data pull in my code behind page. Thanks, Ty  you can use the string.split method and specify your own delimiter. or you can use the string.replace method and replace spaces with whatever character you want to delimit the words in the textbox Do you mean something like, the us...

Adding an IF Statement to the SQL Statement
I have the following tables and SQL statment which works out a league table for me from the given results. I am now trying to add a bit more to this: If the Walkover column = 1 then that row will be a home walkover meaning that the score will be 0(Home Score) - 0(Away Score) but the home team will recieve 3 points, and away team recieves 0 points, win column will be 1 and the played colum will be 1 as well.If the Walkover column = 2 then that row will be a home walkover meaning that the score will be 0(Home Score) - 0(Away Score) but the away team will recieve 3 po...

Problem parsing SQL Statement with backslash and parameter
Hi We are migration from Ado to Firedac (for MSSQL) and noticed that not all existing SQL starements work as before. As an example such a statement won't work anymore (resulting in "Incorret syntax near ':'"): insert into table (field1, field2, field3) values ('test', '\\Server\Share\', :paField3Parameter). Is there a fix or another way how to change the behaviour of the component without the need to change the SQL statements? Thanks FireDAC by default considers '\' as an escape character. Because you are migrating from ADO and do n...

Web resources about - parsing SQL statement - perl.beginners

User:Jimbo Wales/Statement of principles - Wikipedia, the free encyclopedia
As we move forward with software and social changes, I think it is imperative that I state clearly and forcefully my views on openness and the ...

Category:Articles containing potentially dated statements from July 2011 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Tamir Rice's Mother Comments on LeBron James Not Giving Statement on Son's Death - Bleacher Report
One week after Cleveland Cavaliers superstar LeBron James made careful comments regarding the death of Tamir Rice, the boy's mother spoke out ...

Foxborough issues statement on handling of reported Chandler Jones incident
The statement, signed by Foxborough’s town manager, did not provide any new details about the case.

Is Mark Zuckerberg’s latest post about his daughter a political statement?
... doctor. His captioned it, “ Doctor’s visit — time for vaccines! ” and the post went viral (pun possibly intended.) Seen as an official statement ...

Chipotle sued over food safety statements
Chipotle Mexican Grill was sued for allegedly misleading investors about its food safety controls.

Tesla Drivers Do ‘Crazy Things’ While Autopilot Is Engaged, Musk Issues Statement
... within two years, the Tesla will be able to be "summoned," like Lassie, from miles away.

Wheaton College moving to fire professor after Muslim statements
Wheaton College leaders are taking steps to fire the suspended political science professor who drew fire late last year for saying Christians ...

Business on Display: Making a Statement with Digital Signage
The digital signage market is projected to be worth $22 billion by 2020. Join us for our first of four webinars powered by Samsung as we discuss ...

'Affluenza' Teen's Mom's Lawyers Issue Sarcastic Statement to Sheriff
Couch's lawyers asked that proceedings to be conducted "fairly and lawfully."

Resources last updated: 1/15/2016 6:00:32 AM