• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

SQL Encapsulation In variable

Guest
Jul 01, 2006 Jul 01, 2006

Copy link to clipboard

Copied

I think i am missing some thing . when i am doing some thing like this its working

<cfset QueryA = "Select * from Test">
<cfquery name="ABC" datasource="ABC">
#QueryA#
</cfquery>

But how to Add where in IT . ??

<cfset QueryA = "Select * from Test where country = 'US' ">
<cfquery name="ABC" datasource="ABC">
#QueryA#
</cfquery>

i am just trying to make a Dynamic Query . any other ideas are welcomed
TOPICS
Advanced techniques

Views

340

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 02, 2006 Jul 02, 2006

Copy link to clipboard

Copied

First, of all, you have to use the preservesinglequotes function to get querya to run as written.

My other idea is to only make part of the sql dynamic. Something like:

select somefields
from test
where country in (#ListQualify(yourvariable, "'")#)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 02, 2006 Jul 02, 2006

Copy link to clipboard

Copied

LATEST
Dan thanks for the reply . but i am trying to get Input from IM . through Eventgateway and arguments.CFEvent.DATA.Message is comming as a String .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation