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
2 answers

How to select elements from one column and display them as headers in result?

Suppose the PostgreSQL table structure looks like the following: Time | Name | Value w | d | 0 x | a | 1 x | b | 2 y | c | 3 y | b | 4 z | c | 5 z | a | 6 z | d | 7 I have the…
RodCardenas
  • 585
  • 6
  • 14
0
votes
0 answers

How to generate a SELECT statement dynamically based on the properties in a class?

I have a class like the following public class MyClass { public string Name { get; set; } public string Place { get; set; } public string Profession { get; set; } public DateTime DateOfBirth { get; set; } } Now based on the…
A cool bull
  • 341
  • 1
  • 3
  • 12
0
votes
0 answers

How to use Haversine formula in QueryDsl

How can I use haversine formula to filter query results in querydsl? I've got two latitude and longitude columns in my table I need to get nearest places to a specific point by latitude, longitude within a specific distance I need to use Haversine…
Omid QSM
  • 1
  • 1
0
votes
1 answer

SQL Server: execute Temp table inside dynamic query

I am working with temp table and dynamic query as well as. my requirement is in temp table I am inserting some unique value. After that from temp table I get unique key and implement inside where condition. Here is code Temp table: Create Table…
ANJYR
  • 2,583
  • 6
  • 39
  • 60
0
votes
1 answer

Execute multiple dynamic query in stored procedure mysql

I want to execute a query and store the result in temporary table. Then I want to use the temporary table. The query is dynamically created and the stored procedure is below: CREATE DEFINER=`be4`@`%` PROCEDURE `Report_filter_Avg`(in _year…
Sukhvindra Singh
  • 200
  • 2
  • 14
0
votes
0 answers

Dynamic Query Different Behavior While Trigger Creation

Below is part of my code that dynamically creates Trigger. The problem I am facing here is when I run this scrip using Agent Job, the QUOTED_IDENTIFIER within the trigger is set to OFF by default. But when I run it by myself as adhoc query, the…
DNac
  • 2,663
  • 8
  • 31
  • 54
0
votes
2 answers

Postgres Dynamic Query

I have scenario were I have a master table which stores db table name and column name, I need to build dynamic query based on that. CREATE TABLE MasterTable ( Id int primary key, caption varchar(100), dbcolumnname varchar(100), …
Manthan Davda
  • 163
  • 1
  • 9
0
votes
1 answer

How can I use a variable as a clause in sql query?

I am relatively new to sql and programming so please be patient. I have a table where there are three columns similar to the following: penID inkID color 01 2 red 02 2 red 03 2 red 04 1 blue 05 1…
Ylenia88m
  • 83
  • 6
0
votes
3 answers

Must declare the table variable (dynamic query)

I have a stored procedure like this. ALTER PROCEDURE [dbo].[storedProc_dataPull] @serverName nvarchar(30), @dbName nvarchar(30), @tblName nvarchar(30), @schemaName nvarchar (30), @userID nvarchar (30), @password nvarchar…
0
votes
1 answer

Ibatis checking property in array form

I use Ibatis version 1.6 I know that ibatis can read value from array parameter. This is my code SELECT count(1) FROM TB_R_SW103_TAM r WHERE AND convert(DATE,r.TAM_APPROVED_DATE) between convert(DATE, #[0]#) AND convert(DATE,…
HadidM
  • 65
  • 6
0
votes
1 answer

Dynamic update query with parameters in SAP HANA procedures

I have a SAP HANA procedures to update a table. I'm trying to create a dynamic SQL query, this is my example: declare _field varchar(100) := 'NAME'; declare _name varchar(100) := 'david'; declare _id integer := 1; DECLARE SQL_STR…
Shiroga
  • 145
  • 2
  • 8
  • 20
0
votes
1 answer

How to update my table where updated columns names stored in another table in SQL Server

I have table User with n columns that stores user information in it. I have another table User_Edit_Changes that I use to temporarily store changes to table User in it so that after admin confirmation I update the actual table User with new…
M Taher
  • 130
  • 2
  • 13
0
votes
1 answer

Dynamic Function- Oracle

I am trying to create a function by giving 2 variables as inputs. These 2 variables are used dynamically in the function. Am using a select statement in the beginning of the loop to find the primary key column in a particular table. This column is…
bin
  • 111
  • 2
  • 3
  • 10
0
votes
1 answer

Dynamic Query inside TSQL function not able to do

I tried to make sql server function that can generate query based on tablename. However, i am getting this error: Msg 557, Level 16, State 2, Line 1 Only functions and some extended stored procedures can be executed from within a function. Code…
Cookie
  • 25
  • 1
  • 10
0
votes
1 answer

Dynamic MySQL Query error

MySLQ novice here. I am trying to write a query to pivot a large table of weather data. By that I mean the following. I have a table "weatherData" with three columns: 1. "timeStamp", 2. "stationID" (ID of different weather stations) and 3.…
salvador
  • 99
  • 1
  • 2
  • 10