Keep the Single Quotes

I use the following code to generate a list of postal codes for a RADIUS search:
< cfset Caller.passedreturneddata = Caller.passedreturneddata & "" #mystruct.zipcode [x] # "or" > "
"The result is like '12345' or ' 23456" or 34567.

CF transforms the single quotes by double quotes and giving a SQL error below. How can I keep the single quotes?

Run database query error.
[Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Syntax error (missing operator) in an expression of query & apos; cool = No and category = Horoscope and subcategory = Horoscope3 and ZipCode = & apos; & apos; 80212 & apos; & apos; or & apos; & apos; 80212 & apos; & apos; or & apos; & apos; 80212 & apos; & apos; or & apos; & apos; 80034 & apos; & apos; or & apos; & apos; 80214 & apos; & apos; or & apos; & apos; 80214 & apos; & apos; or & apos; & apos; 80214 & apos; & apos; or & apos; & apos; 80214 & apos; & apos; or & apos; & apos; 80211 & apos; & apos; or & apos; & apos; 80033 & apos; & apos; or & apos; & apos; 80033 & apos; & apos; or & apos; & apos; 80033 & apos; & apos; or & apos; & apos; 80001 & apos; & apos; or & apos; & apos; 80002 & apos; & apos; or & apos;

The error occurred in eventsradius.cfm: line 8

6: category = #form.category #.
7: and subcategory = #form.subcategory #.
8: and ZipCode = #form.zipcode #.
9: order by date, time
10: < / cfquery >



--------------------------------------------------------------------------------

SQL Select * From Calendar2 Where fresh = No. and Horoscope = category and subcategory = Horoscope3 and ZipCode = "80212" or "80212" or "80212" or "80034" or "80214" or "80214" or "80214" or "80214" or "80211" or "80033" or "80033" or "80033" or "80001" or "80002" or "80002" or "80002" or "80204" or "80295" or "80257" or "80266" or "80266" or "80248" or "80217" or "80265" or "80292" or "80215" or "80215" or "80215" or "80255" or Order by date time
Normmy_denver DATA source
VENDORERRORCODE-3100
SQLSTATE 42000



Thank you!
David

I got it to work with a variation of what you guys wrote...

And ZipCode IN (#PreserveSingleQuotes (passedreturneddata) #)

Thanks for all the help!
D.

Tags: ColdFusion

Similar Questions

  • magic_quotes_off, now this with the single quote in the variables?

    Okay, so I turned off magic_quotes because they go far anyway. Broke one of my pages and the list of items in the table of database that is supposed to appear was not there. So, I opened the recordset on the page and deleted the apostrophes in the recordset object variables and all reappeared. That tells me I should open EVERY single game records on this site and remove the single quotes? Does that include digital as well as text?

    Thank you for your help.

    Brian

    Magic quotes were originally intended to help beginners (and we are all beginners at some point), but found to be murkier than they are worth. I have to admit that the whole quote, addslashes() and stripslashes() functions had confused me for a while, and I found myself with the backslashes in all directions. It's the partition:

    When you create a query SQL in PHP, it must be a string, it must be enclosed in quotes (single or double - is not serious). However, SQL queries must be enclosed in quotes in the text, and the text you type may also contain a mixture of single and double quotes. The idea of magic quotes is that it automatically inserts a backslash before each quotation mark in a string, which makes the single quotes or double in safe to put in a SQL query text. When you pull the text from the database, you use stripslashes() to get rid of the back-slash.

    The problem is that magic quotes can be disabled, so many books and tutorials tell you move your text to function addslashes() before putting the text in a database. If magic quotes are still on, you end up with two backslashes instead of one. Nightmare. That's why magic quotes are underway.

    Rather than use the addslashes() and stripslashes() functions, it is now recommended to use mysql_real_escape_string() or prepared statements. Given that Dreamweaver does not support prepared commands, I'll leave them out of this. Whenever you pass a variable to a SQL query in Dreamweaver, it passes through the GetSQLValueString() variable, which can detect if magic quotes are enabled. If they are, it will use stripslashes() to get rid of the back-slash; and then it passes variables to mysql_real_escape_string() prepare for insertion in the database. All your single and double quotes in the text are preserved and not a backslash in sight.

    The problem is that if you have a text that has been inserted by using magic quotes and/or functions addslashes(). The simple solution is to use stripslashes() to remove the backslashes in the text stored before you post or use it somehow.

    echo stripslashes($row_recordsetName['fieldName']);
    

    I hope that clarifies the situation and provides a solution. If this isn't the case, it may be necessary to purge your database of backslashes.

    The problem with magic quotes affects only text. Numeric fields are not affected.

  • Select statement with single quotes in the insert statement

    Dear Sir

    What's the trick to cover this issue:

    Insert into TEST_TABLE (SQL_SCRIPT_ID, SQL_SCRIPT)
    values ("1", "select count (*) from the SOURCE where SOURCE.") VALID = 'Y')

    because of the single quotes, I get an error and can not insert, the script works, is there a workaround somehow?

    Thank you 1 million,

    Erik

    Published by: 845498 on June 13, 2012 04:15
    create table testsql(script_id number,sql_script varchar2(1000));
    
    insert into testsql (script_id, SQL_SCRIPT)
    values (1, 'select count (*) from SOURCE where SOURCE.VALID = ''Y''');
    
  • Insert into DB using SQLservice: can't take the text with single quotes:

    I use Execute sql JDBC service statement.

    I'll explain with simple code:

    insert into mytable (id, desc) values (1, 'this is the document of the customer');

    This works perfectly.

    But if I have apostrophes in the desc-

    insert into mytable (id, desc) values (1, 'this is the document the customer' );

    It is throwing error at a standstill operation errors.

    I know that in Oracle, to escape the single quotes that write us

    insert into mytable (id, desc) values (1, "it is of customer" s document ");

    But, we can not control here in Adobe as the desc is from field on a form when the user enters it.

    I'm guessing that it might be a known issue & can someone tell me the solution.

    Thank you

    KC

    Use a parameter query to avoid this problem.

    insert into mytable (id, desc) values (?,?);

    The two parameters (? brands) can be replaced by actual values using XPATH Expression.

    If you do this, you query runs without raising any errors.

    Nith

  • replace a single quote with the double quotes with the function replace

    I work with one apex page, which contains a text as a filter box. If I put a single quote and find then I get the error message saying that parse error.

    For this, I want to replace one single quotation mark with double quotes, so this should be perfect. and apex should show the result.

    A allow the query to the same which will replace the single quote with double quotes.

    Published by: Santhosh Kumar T 15 Sep 2008 05:13

    If it was confusing... Try the less confusion (according to you)! ...

    Select Replace ("ab" | ") "|' it," ',' "') twice;"

  • Using single quotes with MaxL in batch scripts

    I have the following MaxL, I need to pass to essmsh via a batch script:

    run the calculation ' FIX("Member 1") CLEARDATA "member 2"; ENDFIX' on App.Db;

    The problem is that the single quotes cause problems when it is passed as a variable in the batch script. However, if I change single quotes to double quotes the batch script is happy but the MaxL is not valid.

    Please can anyone suggest how I can get this to work?

    You also try that works

    ( @echo login %USER% identified by %PASS% on %SERVER%; & @echo execute calculation "'FIX(\"Member 1\") CLEARDATA \"Member 2\"; ENDFIX'" on App.Db; & @echo logout; & @echo exit; ) | essmsh
    

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • REGEXP_LIKE help literal single quote

    I'm writing a check constraint to validate e-mail addresses which may include an apostrophe in the email address. Like joe.o'[email protected]. Here is my sample configuration:
    create table emails
    ( email_address varchar2(150)
    )
    /
    
    insert into emails values('[email protected]') ;
    insert into emails values('[email protected]') ;
    insert into emails values('joey.o''[email protected]') ;
    
    commit;
    
    sql> select * from emails;
    
    EMAIL_ADDRESS
    -------------------------------------------------
    [email protected]
    [email protected]
    joey.o'[email protected]
    
    alter table emails add constraint email_address_format_ck 
        CHECK ( REGEXP_LIKE ( email_address, '^[a-z0-9._%-]\'?+@[a-z0-9._%-]+\.mil$','c'));
        
    ERROR at line 2:
    ORA-00911: invalid character
    He dislikes *------'? *

    My understanding is that this means one or more of the single quotes. Does anyone know the correct syntax to accept apostrophes?

    Hello

    chris227 wrote:
    In addition to the detailed information given by Frank, I would add a thought on the?.
    I think that the intention of the? subsequently is that there should be only one or none "."

    Good point!

    So it could take into account

    select * from emails
    where
    REGEXP_LIKE ( email_address, '^[a-z0-9._%-]+['']?[a-z0-9._%-]+@[a-z0-9._%-]+\.mil$','c')
    

    That exceeded that, if there is a single quotation mark, should not be the first character, and must not enter immediately before the "@".
    It also requires that it is at least 2 characters before the "@" when there is no single quote. To allow only 1 before the "@":

    SELECT     *
    FROM     emails
    WHERE     REGEXP_LIKE ( email_address
                  , '^([a-z0-9._%-]+''?)?[a-z0-9._%-]+@[a-z0-9._%-]+\.mil$'
                  , 'c'
                  )
    ;
    

    The single quotation mark didn't need to be in square brackets.

  • using single quotes

    Hello

    I write this in the case statement.


    1 case where studentname in (' xyz' is ') then 'pass' end

    Please please help me. I want to know how I can give tat apostrophes inside the drivers because when I put it back tat it completes a Word

    Kind regards
    Sudarshan

    Hello

    Reformulate the case statement

    -case when studentname in ("xyz" one ' ") then 'pass' end

    (IE) replace the single quote with two single quotes * "* to *". "

    Rgds,
    DpKa

  • Single quote

    Hello Experts,

    How you represent a single quotation mark (') in OBIEE?. Just to clarify, what I'm trying to do is to represent the single quote as a character in my report. Is there a hex function or any other thing that can be used?

    Thank you!.

    Pablo.

    Hey Pablo,.

    As in Oracle SQL, an apostrophe can be demonstrated by using two back-to-back apostrophes for example "will be held to a single quote.

    If you wanted this in a report, you will need four consecutive apostrophes, one for the opener of the channel, two for the single quote and one more for the string more closely.

    As a result, "'

    Good luck

    -Joe

  • I have a single folio paid app and I want to migrate to a mult folio app with each folio available for purchase. How can I migrate those who bought my application single-folio so that they are able to keep the folio they paid for in the new folio multi ap

    I have a single folio paid app and I want to migrate to an app of folio to multi with each folio available for purchase. How can I migrate those who bought my application single-folio so that they are able to keep the folio they paid for in the new folio multi application?

    I'm sure that the only way to proceed is to make a free portfolio for all the world in your new application of muli-folio. There is no way to match the records of the purchase of an application with a new application that contains a folio.

    Apple wants to see at least one element of the library is available free of charge, in any case if the application has a utility when downloaded from the store anyway.

    Neil

  • How to retrieve the values of character without using single quotes

    Hi all

    How to retrieve the values of character without the use of single quotes. Its Possible in Oracle SQL

    Please answer me...

    For example

    Is actual query-> Select * from employees where name like in("SCOTT", "JAMES", "ALBERT",...);

    I want to--> Select * from employees where name like(SCOTT, JAMES, ALBERT...); -without the use of single quotes.

    Why I need this application, I need to retrieve the records more than 200 employees in a select statement by using name in where clause.

    shagarmahabubjan wrote:

    Hi all

    How to retrieve the values of character without the use of single quotes. Its Possible in Oracle SQL

    Please answer me...

    For example

    Actual query is---> Select * from employees where name like in("SCOTT", "JAMES", "ALBERT",...);

    I want to---> Select * from employees where name like(SCOTT, JAMES, ALBERT...); -without the use of single quotes.

    Why I need this application, I need to retrieve the records more than 200 employees in a select statement by using name in where clause.

    In short... you can't.  The channels are channels, and SQL and PL languages dictate that the string literals are provided within single quotes.

    I don't see how trying to retrieve more than 200 records of employees in the select statement means that you must get rid of the quotes.

    Be clear in what you ask: Re: 2. How can I ask a question on the forums?

    and take note of the FAQ link davidp provided the solution "variable IN the list.

  • Unable to [out] the value of the parameter put_line with single quotes (apostrophe)

    Hello

    I want to store a common code in a sql file and where the different clauses as a parameter, so the structure is:

    Main.SQL Script:
    set m_sWhere = ' owner = "SCOTT" ';
    @MyReport.sql '& m_sWhere '.

    MyReport.sql
    OK: SELECT * FROM MyTable WHERE & 1
    ERR: dbms_output.put_line ('MyWhere: & 1');

    I am not able to print the where the clause. I already tried to set the where clause with other delimiters (e.g. #SCOTT #) and replace # by ' in the MyReport but failed as well.

    All advice welcome.

    Published by: netaktiv on 11.02.2012 08:35

    Hello

    netaktiv wrote:
    Hello

    I want to store a common code in a sql file and where the different clauses as a parameter, so the structure is:

    Main.SQL Script:
    set m_sWhere = ' owner = "SCOTT" ';
    @MyReport.sql '& m_sWhere '.

    Sorry; It is unclear what you are trying to do, and what you're doing.
    I think the only single-quoptes in m_swhere are those before and after SCOTT:

    DEFINE  m_sWhere = owner='SCOTT'
    

    That's what you need to be able to use this variable in an SQL statement. SQL * more will replace & 1 with its value. If you were typing the statement directly, just type a single before and after SCOTT quote, if you want only a single quote before and after SCOTT in m_swhere. You use 2 single quotes in a row inside string literals, but the string literal only you need here is the literal 5 characters 'SCOTT', containing sound ", a 'C', 'o', two ' t and single quotes to zero."

    MyReport.sql
    OK: SELECT * FROM MyTable WHERE & 1
    ERR: dbms_output.put_line ('MyWhere: &1');)

    I am not able to print the where the clause. I already tried to set the where clause with other delimiters (e.g. #SCOTT #) and replace # by ' in the MyReport but failed as well.

    You do not want channels OK: or ERR: in the script.
    Dmbs_output.put_line, like any procedure, only works in PL/SQL.
    If you want to display text in a SQL * more script, use the SQL * FASTER command, like this:

    PROMPT  MyWhere: &1
    

    If you really must use dbms_output.put_line, then you will need to use a string literal, and single quotes can be tricky.
    In Oracle 10 (and more) use Q-rating:

    BEGIN
        dbms_output.put_line ( Q'{MyWhere: &1}' );
    END;
    /
    

    {Quotes will not be a problem unless they occur immediately after a right '}'.

  • Display the string with single quote

    Hello..

    I have a doubt.

    Below the statement works very well to get the result in single quotes as 'Hello world'
       SELECT '''Hello World'''
       FROM dual;
    Now my question is why we get error when we try to do the same.

       SELECT ''Hello World''
       FROM dual;
    Please let me know the reason, if an organization is to have an idea.

    Thank you
    Suri

    To print a single quotation mark, use two single quotes (IE he "s to print from) and to print a string to write the string inside the single quotation mark as"Hello Word ".
    You want to print "Hello World" your sql will be

    SELECT '''Hello World'''
       FROM dual;
    

    You get the following error as search oracle of KEYWORD Analyzer after "that a chain is closed using the" quote

    SELECT ''Hello World''
       FROM dual;
    ORA-00923: FROM keyword not found where expected
    
  • Monthly payment? How can I download Adobe illustrator to keep without pay every month to own the software? I am indifferent in the 20 GB of cloud storage or ProSite portfolio website that comes with the purchase of the single app, I was just looking for a

    Do I have to continue to pay to keep the product? I can't just he buy?

    None no more. Adobe went subscription only.

    Subscriptions include updates, vital as Windows, Mac and Harware changes are obsolete and unnecessary software faster than ever.

  • Get the set of results within single quotes.

    SQL>SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE='TABLE';
    
    OBJECT_NAME
    ----------------------------------------------------------------------------
    BONUS
    CHILD
    DEPT
    EMP
    EMP_DTL
    ENTRY
    How can I get this result set in single quotes as
    OBJECT_NAME
    ----------------------------------------------------------------------------
    'BONUS'
    'CHILD'
    'DEPT'
    'EMP'
    'EMP_DTL'
    'ENTRY'
    Published by: GarryB on May 12, 2009 04:07
    SQL> select ''''||ename||'''' from emp;
    
    ''''||ENAME|
    ------------
    'SMITH'
    'ALLEN'
    'WARD'
    'JONES'
    'MARTIN'
    'BLAKE'
    'CLARK'
    'SCOTT'
    'KING'
    'TURNER'
    'ADAMS'
    'JAMES'
    'FORD'
    'MILLER'
    
    14 rows selected.
    
    SQL>
    

Maybe you are looking for