How do I write a query when the query itself is in the columns of the tables?
-
For example: I have a table called HD_Es_FilterDetail With columns: filterdetail_ID, filter_ID, field_name, operator and criteria. The combination field_name, operator and criteria should build a SQL an SQL query Thus: Field Name = DueDate Operator = < Criteria = GetDate() DueDate < GetDate() Another table HD_dashreports Columns: report_id, sql_statement How do I write the query that executes whatever is the query inside the sql statements column What’s the SQL query for that? I have accustomed to making a query directly and not from a column data. Please, thanks.
-
Answer:
Sound like you need dynamic SQL. Look for EXECUTE statement.
JK at Yahoo! Answers Visit the source
Related Q & A:
- How do I write a good peer review?Best solution by Quora
- How do I write a search page?Best solution by Stack Overflow
- How can I write a good reference letter?Best solution by dailywritingtips.com
- How do I write a Photography Price Quote?Best solution by Yahoo! Answers
- How do I write a resume for a part-time job?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.