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

SQL Procedure that Insert in a table a result of a dynamic query

Im trying a lot of combination but always having errors. (the Select/insert with replacing my variable in hard code is working outside of procedure) Basically my proc have to do a dynamic select that receives a date variable as string and return a…
Flib
  • 165
  • 3
  • 14
0
votes
1 answer

Dyamic LINQ library, give name to columns that contain space

I need to create a query that returns data with column name (without square brackets) as indicated in the code below. How can I do that? var query = db.Customers .Where("City = @0 and Orders.Count >= @1", "London", 10) .OrderBy("CompanyName") …
0
votes
1 answer

MySQL: Syntax error, unexpected '@', expecting ':'

I want to create temp table dynamically. I am passing column name as a parameter to stored procedure. Example: DELIMITER $$ create procedure sptemp(IN nm varchar(50)) BEGIN SET @q = CONCAT('CREATE TEMPORARY TABLE temptable  // Error occuring here…
Sarfaraz Makandar
  • 5,933
  • 16
  • 59
  • 84
0
votes
1 answer

Dynamic Query Restructuring for View

I have created a dynamic SQL query that I want to use as a view, however, the query is dependent on using 'DECLARE' statements. I have tried unsuccessfully to restructure it without the 'DECLARE' statements, but can't quite get it right. I am…
EAP
  • 1
0
votes
0 answers

Dynamic Casting of data from one table to another using SQL SERVER

I have a store procedure which is fetching column details of a table. Say this table name is Invoice table. I have another table, Invoice_Staging table, which has data in varchar format. Now I wish to fetch data from Invoice_staging, cast the…
coddey
  • 390
  • 2
  • 13
0
votes
1 answer

Is there a way to stash an entire SQLite query result into a string?

I want to - just for "Proof of Concept's sake" - display an entire query result set as a string. And I want the table queried to be a variable. How can it be done? I've got the following start: public String[] getAllRecordsFrom(String tblName) { …
0
votes
1 answer

Import Excel .xslx file into sql server : difficulty in updating table

I am importing excel file into sql server datatbase. The code works fine but the way I am doing currently is deleting (clear the table) the table data. string ssqltable = "tStudent"; string myexceldataquery = "select…
user2525244
  • 91
  • 1
  • 3
  • 12
0
votes
0 answers

Dynamic query in the trigger for different tables

I've a trigger on the CONTENT table after update. In the table when the MESSAGE column value updated trigger has to insert a new record with CONTENT_ID and MESSAGE into one of the 4 different tables based on the country. Country value will be…
RajKP
  • 263
  • 1
  • 3
  • 6
0
votes
1 answer

Oracle APEX Complex programming

I have a Combo Box and I want to show some data when item is selected. Assume the following data table TRANS_ID 1 DATA_AR تجريب DATA_CH 测试 DATA_EN Testing and the application supposed to be shown as Change Language? Some data on…
0
votes
0 answers

How combining DynamicQuery and AssetEntryQuery

I have a problem with Dynamic Query in Liferay 6. I'm trying to make a query to get images (from the Liferay Documents and Media repository) that have a title determined, are in a folder specific, and that are in a particular category. For the query…
user998871
  • 113
  • 1
  • 1
  • 13
0
votes
2 answers

error while inserting data using dynamic insert datatype varchar cannot convert to int

i have following query,which is used to insert data to table dynamically,i have checked the data type of table and parameter which im passing both are same,but still having following error: 4 1 Msg 245, Level 16, State 1, Line 43 Conversion failed…
shweta
  • 319
  • 2
  • 8
  • 21
0
votes
2 answers

Exception when using Projection with DynamicQuery in liferay 6.1?

Since when edit a web content, liferay automatically creates new version of an article, I want to get the latest version of a specific article. I used the dynamic query as follows: DynamicQuery query =…
ipkiss
  • 13,311
  • 33
  • 88
  • 123
0
votes
1 answer

liferay 6.0.6 how to use DynamicQuery for class com.liferay.portal.model.User

I'm deploying a portlet on liferay portal 6.0.6. I used DynamicQuery to access to com.liferay.portal.model.User object. My code: DynamicQuery userQuery = DynamicQueryFactoryUtil.forClass(User.class, PortletClassLoaderUtil.getClassLoader()); …
supper aban_89
  • 339
  • 1
  • 2
  • 15
0
votes
2 answers

How to use " ' " in a dynamic query in sql server?

I have stored Procedure for Search. ALTER Proc [dbo].[USP_GETFAQ] @SortBy Varchar(128)='CreatedDate DESC', @Page int=1, @RecsPerPage int =10, @Status Char(5)='', @Question varchar(500)='', …
Ram Singh
  • 6,664
  • 35
  • 100
  • 166
0
votes
1 answer

EF Dynamic Query - Like

After successfully implementing a like function with use of string function 'contains' I noticed that wildcards are escaped when translated to sql. Eg. When I search for a street starting with p and has number 13 in it. I replace all space with '%'…
sysboard
  • 287
  • 7
  • 19