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

Dynamic SQL query which is based on current month

Below is a SQL Code which creates a table from the union of monthly data summaries: -- Oct 2017 select distinct a.device_id ,201710 as month_id, case when group_descr in ('BASE') then 'Basic' when group_descr in ('VALUES') then 'Valuable' …
Shuvayan Das
  • 1,198
  • 3
  • 20
  • 40
0
votes
2 answers

How can execute dynamic sql if it is varchar2

I have PL/SQL function which is dynamically creating select statement an return this statement as varchar.Because I need this statement work dynamically(each time return different column count/name).For example it can return this select 'select…
0
votes
0 answers

Mysql Prepared Statement with dynamic column based on Date

Hi I have a prepared statement inside a stored procedure with dynamic generation of columns based on Creation Date. The problem is when I execute my stored procedure once its okay and running well. But when i change its parameter values. It gets…
PapaP
  • 1
  • 3
0
votes
2 answers

How to use Table -Valued Parameter with Dynamic qry

I am using Table - Valued Parameter for to build dyNamic Query Using the Following code AlTER PROCEDURE [dbo].[ABC] @tblName Varchar(1000), @Details ABC_TYPE Readonly AS BEGIN Declare @PK as nvarchar(1000) Declare…
0
votes
2 answers

Dynamics webquery from url in cells

I searched the internet, but I could not find anywhere a dynamic query from links in cells. In excel i have webquery which generate this data: I have data in excel Sheet("CustomReport"): SalesOrder Value1 Value2 Value3 Links 1 …
Seva Arve
  • 65
  • 8
0
votes
1 answer

Query taking more time

I have a Master table.This table contains two fields Listings(Master Table) -------- TableID EntityID 30047 100 30047 101 30047 102 In above table TableID (30047) contains 1.5 million entityids…
Ram
  • 727
  • 2
  • 16
  • 33
0
votes
1 answer

Casting Strint to integer in liferay dynamic query

I have been using dynamic query for a project. Here is an scenario for which I am facing problem. For a table xyz the column version is stored as varchar (I know it's a poor design, but it's too late to change now) and has values as 9,12. For the…
Navankur Chauhan
  • 407
  • 6
  • 22
0
votes
3 answers

How to extract a value from Dynamic SQL result?

I'm trying to get a few values from a dynamic SELECT This is my code: DECLARE @sqlCommand varchar(1000) DECLARE @colName varchar(20) DECLARE @tableName varchar(20) DECLARE @myNum int DECLARE @varDate varchar(19) DECLARE @myTime datetime2 set…
Moran Barzilay
  • 133
  • 2
  • 13
0
votes
1 answer

SQL dynamic query for insert

I have a SQL Server table with these columns: Product | QTY | DISCREPANCIES and I want to insert multiple records using a stored procedure. Inputs for my procedure are : declare @Product varchar(50) = 'product1'; declare @QTY int = 1; …
Dhaval
  • 1
  • 3
0
votes
5 answers

Linq query construction based on empty parameters

I have an object like this: public class Filters { List A { get; set; } List B { get; set; } } I will use it as parameters of a function that will execute a query on a Database. These itens, A and B, will indicate the…
R.Santos
  • 11
  • 2
0
votes
0 answers

How to call events inside stored procedure in MySQL

I want to run multiple events in different schemas. I am trying to use the events inside in one stored procedure. So that I can execute one Sp for all the schemas. But I am getting "Recursion of EVENT DDL statements is forbidden when body is…
Subramanian
  • 29
  • 2
  • 10
0
votes
1 answer

How to get total count and list of records using the Entity Framework 6 SqlQuery

I have some complex requirement where user can filter result based on several parameters. I have used Entity Framework SqlQuery to prepare the dynamic query. So in the application i wanted to display - Total No of Records available by applying the…
imdadhusen
  • 2,493
  • 7
  • 40
  • 75
0
votes
1 answer

Manupilating previous month data according to current month

I have one table name Prv_Data which contain previous month of report, having Report_Id and Timeline column. Prv_Data --> Report_ID | Timeline ---------------|-------------- 01 | Weekly @Mon 01 | Weekly @Mon 01 …
Jayank
  • 81
  • 1
  • 11
0
votes
1 answer

Creating Generic MySQL SELECT Statement in C#

There are a few similar questions, but none of them seem to answer my problem. In my application I use lots of different SELECT queries and I don't want to write a method for every one, so I'm trying to create a generic one that I can just pass the…
0
votes
0 answers

Dynamic Query VS Static Query Performance

I wrote 2 stored procedures that read the same data depending on their parameters, one using static query sp_Order_Read1, and the other using a dynamic one sp_Order_Read2. They read the data of Orders table in Northwind sample database; on SQL…