An Ad-Hoc Query is a query that cannot be determined prior to the moment the query is issued. It is created in order to get information when need arises and it consists of dynamically constructed SQL which is usually constructed by desktop-resident query tools. This is in contrast to any query which is predefine and performed routinely.
Questions tagged [adhoc-queries]
39 questions
202
votes
11 answers
What is Ad Hoc Query?
I'm reading a book about SQL. In that book there's the term Ad Hoc Query, which I don't understand.
What exactly is an ad hoc query?

zihado
- 2,311
- 3
- 15
- 8
17
votes
6 answers
Ad hoc queries vs stored procedures vs Dynamic SQL
Ad hoc queries vs stored procedures vs Dynamic SQL. Can anyone say pros and cons?

Kristaps
- 187
- 1
- 1
- 3
12
votes
3 answers
Select top/latest 10 in couchdb?
How would I execute a query equivalent to "select top 10" in couch db?
For example I have a "schema" like so:
title body modified
and I want to select the last 10 modified documents.
As an added bonus if anyone can come up with a way to do the…

Andriy Drozdyuk
- 58,435
- 50
- 171
- 272
5
votes
1 answer
What is the difference between ad hoc and prepared query in sql server plan cache?
I’m trying to understand the plan cache content of a sql server.
so my questions are:
1. What is the difference between ad hoc and prepared plans?
2.What should I know about it when trying to optimize the sql server plan cache?

r0tt
- 379
- 3
- 20
5
votes
2 answers
Open Source & Free Adhoc / End User Reporting Tool
I am looking for an Open Source & Free Browser based Adhoc / End User Reporting Tool preferably based on Java (any other technologies are also welcome).
I have researched on JasperServer Pro, BIRT & Pentaho. Even though these are open source &…

Santhanam
- 67
- 2
- 6
4
votes
1 answer
Grafana with InfluxDB: Ad hoc filter is always empty
Data source query language: Flux
Grafana Version 7.4.3
InfluxDB 2.0.4
Can anyone explain how does Ad hoc filter work? How is drop down list generated?
In my case it always says No options found:
Variable settings:
Do I have to write appropriate…

Narek Hambardzumyan
- 425
- 2
- 14
3
votes
5 answers
Best way to store SQL in variables
Currently I put my query in a variable like this.
query = @" select top 1
u.UserID
from
dbo.Users u
where
u.SystemUser = 1
and u.Status = @Status";
The problem…

user247702
- 23,641
- 15
- 110
- 157
2
votes
3 answers
How do I programmatically build ad-hoc queries quickly?
I've used Excel PivotTable to analyze data from my database because it allows me to "slice and dice" very quickly. As we know what is in our database tables, we all can write SQL queries that do what PivotTable does.
But I am wondering why…

Martin08
- 20,990
- 22
- 84
- 93
2
votes
1 answer
Are all Queries in MongoDB ad-hoc?
Sorry, maybe the question is stupid, but I can't figure it out. Are all queries in MongoDB ad-hoc? Or ad-hoc queries can be executed in special cases?

robby
- 25
- 3
2
votes
1 answer
Laravel MSSQL Adhoc queries instead of prepared
We are using MSSQL in combination with Laravel which uses the dblib PDO library from PHP. I've looked in the illuminate database part and see that it uses the PDO->prepare($query)->execute($bindings). So I am expecting that it would execute a…

Sven Buijsrogge
- 139
- 1
- 13
2
votes
1 answer
Best filter for MANET
I know about Bloom filter. It is very useful where storage requirement is less and where we need to check only whether element is "definitely not exist" or "may exist" e.g. mobile devices, browser in-memory.
As Best example given by Tarun
I need to…

pathe.kiran
- 2,444
- 1
- 21
- 27
2
votes
2 answers
SubSonic How to Execute a SQL Statement?
My site is using Subsonic 2.2 on my site.
I have 1 weird situation where I need to run some ad-hoc SQL statements.
public IList GetDistincList(string TableName, string FieldName)
{
string sqlToRun = string.Format("SELECT DISTINCT {0}…

aron
- 2,856
- 11
- 49
- 79
1
vote
2 answers
SQL ad-hoc report of ALL users not completed a course
Hya Gang!
I am very close to figuring out a report I can run ad hoc to find all our users who have not enrolled in a course. I do have a report for enrolled people that have not completed the course, but this search is not finding a given student…

DKeeler
- 33
- 3
1
vote
2 answers
issue formatting into human time
SELECT
prefix_grade_items.itemname AS Course,
prefix_grade_items.grademax,
ROUND(prefix_grade_grades_history.finalgrade, 0)
AS finalgrade,
prefix_user.firstname,
prefix_user.lastname,
prefix_user.username,
…

Voximus14
- 11
- 1
1
vote
1 answer
SSRS ad hoc distributed queries issue
I have a big query that I'm trying to execute however SQL SERVER is giving me an error telling me I can't do it because I do not have ad hoc distributed queries enabled. Here's what the error looks like:
After doing some research it looks like I…

BobSki
- 1,531
- 2
- 25
- 61