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

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.

NG
natGAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crchambersCommented:
First, I would make a new table for all the saved queries. The table would look something like this:

tableQueries
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)
</cfquery>
(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?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrichmonCommented:
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.

mrichmon
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.