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
1
vote
3 answers

How Can I Make Oracle Query Sort Order Dynamic?

I have a Oracle procedure inside a package like this PROCEDURE getEmployee ( pinLanguage IN VARCHAR2, pinPage IN NUMBER, pinPageSize IN NUMBER, pinSortColumn IN VARCHAR2, …
1
vote
1 answer

How to check existence of tables in different databases in a proc - SQLServer

I am working on a proc which is present in one database, it picks table from other source database (passed as parameter) and insert missing values to other destination database (again passed as parameter). My insert query is a dynamic query and…
KnowledgeSeeeker
  • 620
  • 1
  • 9
  • 14
1
vote
1 answer

How to build a Dynamic Query in Cassandra?

As per the Forums and Few Folks experience i understood Java Driver can help as per the following post .. Cassandra 3 Java Driver build dynamic queries1 But is there any way to build a query in Cassandra with out java driver. Unfortunately No One…
Prasad
  • 1,562
  • 5
  • 26
  • 40
1
vote
2 answers

To add a local variable value to a dynamic query result set

I have a dynamic query where in I want to add the value of a local variable to every row of the result set. I have a simplified version of the example below. While this query works fine: DECLARE @purchaseDate AS DATE SET @purchaseDate =…
The_Outsider
  • 1,875
  • 2
  • 24
  • 42
1
vote
2 answers

insert result of dynamic pivot query into temp table

I have a dynamic pivot query SELECT * FROM (SELECT [SERVICEID], [SERVICETYPEID],[TRAIN],[SERVICETYPEOPTIONID], [OPTIONNAME], [CLIENTID],[AGENT], [MANAGEMENTLEGID ], [LEG], …
Phoenix
  • 263
  • 1
  • 3
  • 13
1
vote
2 answers

Dynamic delete based on update table

I want to write a dynamic script that removes duplicates. I want to try and avoid a CURSOR so I've been looking into writing strings instead that will have table in one column and corresponding table attributes in another. I have also tried dynamic…
CobraKaj
  • 37
  • 6
1
vote
1 answer

Creating SQL-Injection proof dynamic where-clause from collection in PL/SQL

I need to execute a query where the where-clause is generated based on user input. The input consists of 0 or more pairs of varchar2s. For example: [('firstname','John') ,('lastname','Smith') ,('street','somestreetname')] This would translate…
Kenny Steegmans
  • 307
  • 4
  • 21
1
vote
0 answers

Group by query not executing as expected

I have query like this for TheEntity type: var source = await _repository.Queryable.AsNoTracking() .Where(Condition1()) .Where(Condition2(params)) .GroupBy(GroupByFunction) …
1
vote
0 answers

Recursive query in Hive/IBM DataStage

I'm new in Hive and Datastage development. I'm trying to do a recursive query like we can do in Orcale with connect by or with clause, but Hive doesn't support recursive queries. Is there any way to do this in Hive? Or to do the logic through IBM…
1
vote
2 answers

Using a dictionary to pass parameters to postgresql statement in python

I have defined a dictionary which contains several parameters and their values which will ultimately be used to build a SQL Query query_params = collections.OrderedDict( {'table_name':'publilc.churn_data', 'date_from':'201712', …
Shuvayan Das
  • 1,198
  • 3
  • 20
  • 40
1
vote
4 answers

Execute dynamic query only to get affected row count

I want to execute a dynamic query to get the affected row count. But SQL Result pane returns me the result after executing it. How to avoid returning the columns. I tried the below way. DECLARE @Command NVARCHAR(MAX)= 'SELECT * FROM Product WHERE…
Harsha W
  • 3,162
  • 5
  • 43
  • 77
1
vote
1 answer

dynamic query laravel eloquent with whereHas

I want to create dynamic filters. for example I want to create this code $Contact = Contact::whereHas('User', function ($query) use ($searchString) { $query->where('name', 'like', '%Jhone%')->orwhere('family', '<>' . 'Doe'); …
paranoid
  • 6,799
  • 19
  • 49
  • 86
1
vote
2 answers

How do I use ADO Parameters at run time in Delphi 2006?

I have been banging my head against the desk with this. I have a simple table with 2 columns, like so: CREATE TABLE [dbo].[MiscInitializers]( [PKey] [int] IDENTITY(1,1) NOT NULL, [Value] [text] NULL, CONSTRAINT [PK_MiscInitializers] PRIMARY KEY…
wades
  • 927
  • 9
  • 24
1
vote
1 answer

How do I turn an array into a record / tuple / row type?

I need to execute a dynamic insert into a table with a variable number of columns. Right now I'm quoting both the column names, with quote_ident, and the actual values, with quote_nullable, and then joining them with array_to_string: for ... loop …
Tobia
  • 17,856
  • 6
  • 74
  • 93
1
vote
1 answer

How to pass a array of parameters in dynamic query Life ray?

I can able to write dynamic query for id like this DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Custoxxxx.class, PortletClassLoaderUtil.getClassLoader(); 2dynamicQuery.add(PropertyFactoryUtil.forName("xxxId").eq(new…
Ravi R
  • 73
  • 1
  • 11