Questions tagged [dynamicquery]

Use this tag for questions related to dynamic queries; queries that are built dynamically rather than provided as an explicit query string.

is usually found in questions related to SQL, C#, Drupal, Java, etc., so if you are about to use this, make sure you accompany it by the corresponding tag of your programming environment.

344 questions
0
votes
1 answer

How to pass parameters to Pentaho Report (.prpt) so that sql query can run dynamically to make report at runtime

I have a static Pentaho Report(.prpt) on my pentaho server.I am trying to find the way to pass paramater to my pentaho report and refresh(update) the report using pentaho scheduler.I am able to run the sql query each time the scheduler runs. But I…
0
votes
4 answers

Removing 'union all' at end of last record in dynamic query

For my question I have set up a simple example to illustrate my problem. Let's say you have a dynamic query that generates several select statements with a UNION ALL between them. Is there a way to prevent the 'UNION ALL' at the end of the last…
brother
  • 3
  • 1
0
votes
1 answer

Error executing dynamic select query inside a stored procedure in IBM DB2

What is wrong with the below code? I am trying to execute a dynamic query inside a stored procedure in DB2. My procedure is getting created CREATE PROCEDURE get_users( in offsetValue integer, in sortCol varchar(20) …
deepak asai
  • 202
  • 1
  • 5
  • 17
0
votes
1 answer

Dynamic Filter to the SQL Server Query

I have a Query like below WITH TempResult AS( SELECT AccessionNumber FROM [CASE] UNION ALL SELECT AccessionNumber FROM CaseReassign), TempCount AS (SELECT COUNT(AccessionNumber) AS MaxRows FROM TempResult) SELECT * FROM TempResult, TempCount Which…
Srini
  • 132
  • 8
0
votes
2 answers

create a dynamic query using cmd.parameter c#

I know there are many questions related to create a dynamic query but no one can help me. I am trying to create a dynamic cmd.Parameters.AddWithValue with the help of foreach loop but I can't find all the values that I pass in foeach. I know I am…
Minhaj Patel
  • 579
  • 1
  • 6
  • 21
0
votes
1 answer

Dynamic table name and variable name in query in SQL Server

I am trying to make a query that I can run from Python with dynamic table name and date. In the process of this, I have tried the following query in SSMS, but it is producing an error message. How can I use variables for table name and a date, and…
dagrun
  • 621
  • 3
  • 11
  • 29
0
votes
3 answers

How to load data in different servers

I am designing an ETL project on SSIS and I want it to be dynamic. I will use this project for many customers therefore I will query these extractions against different servers. For example, I have this query in a step with "execute SQL task"…
Pouya Kamyar
  • 133
  • 1
  • 9
0
votes
1 answer

in MS Access, after creating a dynamic query, how does one update the textboxes on the form with the corresponding values from the recordset?

Following the example here: https://support.microsoft.com/en-us/help/304302/how-to-build-a-dynamic-query-with-values-from-a-search-form-in-access I have created a search button that searches a table and seem to pull in the correct SQL statement.…
CharlieTango92
  • 169
  • 1
  • 2
  • 10
0
votes
0 answers

Compare two table using dynamic database

I have 2 table (same name) on 2 different database I want compare these table, this is my procedure ALTER PROCEDURE COUNTCOLUMN @TABLENAME NVARCHAR(MAX), @DATABASENAME1 NVARCHAR(MAX), @DATABASENAME2 NVARCHAR(MAX) AS BEGIN …
Hau Le
  • 25
  • 1
  • 7
0
votes
2 answers

Entity Framework query based on string stored in configuration file

i would like to know if you have any idea how i can achieve this, considering a query stored as string in the configuration file. I tried to use SqlQuery applied to the DBSet, but the problem is that SqlQuery requires me to select all properties of…
Hugo Barona
  • 1,303
  • 9
  • 21
0
votes
2 answers

SQL Server loop through dynamic query

I have a procedure where I pass temporary table name as parameter. For each dataset inside I need to get rowcount. How to achieve this? I need something like: CREATE PROCEDURE sp_processing @temp_table_name varchar(50) AS DECLARE @log…
Jakub P
  • 542
  • 4
  • 21
0
votes
1 answer

Using execute to store column data in an array in postgresql

I am creating a dynamic query to extract some data from a table. I want to store that data in a variable but it cannot store more that one value. And I can also use temp table but in some cases I am not allowed to use that also. Now I was trying to…
Vishal D
  • 51
  • 9
0
votes
1 answer

Using execute in subquery in postgresql

I am creating a dynamic query in my function from which I need to extract data. now I want to execute that query. something like this: declare df_id varchar; BEGIN /*creating dynamic query in run time and saving it in df_id in string format say…
Vishal D
  • 51
  • 9
0
votes
1 answer

building dynamic linQ queries

I have seen a few old post but cannot figure out how to achieve this, Please help with an example. I need to create a filter method to get data based on user inputs in a form, which may be random in nature. My current code is given below, which i…
0
votes
1 answer

Using EXECUTE in WITH query in postgresql

I am extracting data from a table using execute query. now I want to store this data in some variable to use it for other operation, and I cannot use temp table so I have to use WITH query. --Something like this: with ttable (col1, col2) as…
Vishal D
  • 51
  • 9