Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Dynamically building a query w/ variables and CF constructs to be saved...

Posted on 2003-03-27
Medium Priority
Last Modified: 2013-12-24
I just want to let you all know that I am picking back up on a thread of mine from a few weeks ago:   http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20546693.html 

I thought the original solution would work, but now it is clear that I need to be able to save the SQL string in my DB and load it for different users as they log in. The string is the query to generate their custom-filtered list that is pulled from a different table in the same db.

Please refer to the thread above, and thanks in advance for any suggestions.

Question by:natG

Accepted Solution

crchambers earned 200 total points
ID: 8239390
First, I would make a new table for all the saved queries. The table would look something like this:

queryID Autonum
studentID Number (FK to studenttable used to link student to query)
querySrc Memo

Now define a new cfinsert:

<cfquery datasource="datasource" name="insertquery">
INSERT INTO tableQueries(student_ID,querySrc) VALUES(
'#student_ID#', strSQL)
(I may be missing some quote marks, but this is the general idea)

Every time you run the strSQL, make the insertquery fire as well, by running the insertquery directly after running the dynamic query you mentioned before... Is that what you're looking for?
LVL 35

Expert Comment

ID: 10940919
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation in the Cleanup topic area:

Accept crchambers

Please leave any comments here within the next four days.

EE Cleanup Volunteer

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question