Re: SQL Query with %

This WebDNA talk-list message is from

2007


It keeps the original formatting.
numero = 68967
interpreted = N
texte = Nevermind. I found an old post in the archives. The answer is to escape the % with another %. So you end up with %% to make it work. On 5/8/07 10:38 AM, "Clint Davis" wrote: > Every time I try to use [sqlexecute] with a query containing the percent > sign, it fails. What is the workaround here? > > This query works fine in phpMyAdmin, but fails in WebDNA: > [text]beginYear=[format days_to_date %Y-%m-%d][math]{01/01/[date > %Y]}[/math][/format][/text] > [text]endYear=[format days_to_date %Y-%m-%d][math]{12/31/[date > %Y]}[/math][/format][/text] > > [sqlexecute conn_ref=conn1&result_var=rs1]SELECT * from consumers WHERE > DATE_FORMAT(POSTDATE, '%Y-%m-%d') >= '[beginYear]' AND DATE_FORMAT(POSTDATE, > '%Y-%m-%d') <= '[endYear]';[/sqlexecute] ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: SQL Query with % ( Clint Davis 2007)
  2. SQL Query with % ( Clint Davis 2007)
Nevermind. I found an old post in the archives. The answer is to escape the % with another %. So you end up with %% to make it work. On 5/8/07 10:38 AM, "Clint Davis" wrote: > Every time I try to use [SQLexecute] with a query containing the percent > sign, it fails. What is the workaround here? > > This query works fine in phpMyAdmin, but fails in WebDNA: > [text]beginYear=[format days_to_date %Y-%m-%d][math]{01/01/[date > %Y]}[/math][/format][/text] > [text]endYear=[format days_to_date %Y-%m-%d][math]{12/31/[date > %Y]}[/math][/format][/text] > > [sqlexecute conn_ref=conn1&result_var=rs1]SELECT * from consumers WHERE > DATE_FORMAT(POSTDATE, '%Y-%m-%d') >= '[beginYear]' AND DATE_FORMAT(POSTDATE, > '%Y-%m-%d') <= '[endYear]';[/sqlexecute] ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Clint Davis

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

What file? (1997) Looking for WebDNA calendar (2004) Help name our technology! (1997) Nested tags count question (1997) WC2.0 Memory Requirements (1997) Faxing orders in place of email (1997) WebCatalog Technical Reference (1997) (1998) Accented chars and emailer (1998) Menu to select product variations (1997) WebCat2 - [SendNews] (1997) zip codes (2003) Date Range search (1997) wish list (2002) WebCat and search engines (1998) Cookies and webcat (1997) Multiple catalog databases and showcart (1997) Bulletin Board (1998) page chokes on hideif when false and ignored (1998) Introduction/Tutorial/QuickStart (1997)