Questions tagged [generated-sql]
9 questions
16
votes
3 answers
Get max & min from Entity Framework, in one query and with best query possible
I'm aware of this question, but what I would like to do is obtain something close to this generated SQL:
select MAX(Column), MIN(Column) from Table WHERE Id = 1
When I try this:
var query = from d in db.Table
where d.Id == 1
…

Benjol
- 63,995
- 54
- 186
- 268
10
votes
2 answers
Entity Framework - View Sql using toTraceString
I'm trying to view the generated sql that Entity Framework 5.0 generates from an entities query. All over the web, everyone says to cast the IQuerable object to an ObjectQuery object and then use the toTraceString() method to return the generated…

Rafi
- 2,433
- 1
- 25
- 33
5
votes
1 answer
Why does Linq ignore my where clause?
I see several StackOverflow questions on this already but not of them seem to match my scenario. I promise I looked.
I have some queries against my database that I'm using linq to do and I can't figure out why the incorrect SQL is being generated.…

Justin williams
- 574
- 1
- 8
- 26
5
votes
2 answers
What's the difference between these two LINQtoSQL statements?
These two statements look the same logically to me, but they're resulting in different SQL being generated:
#1
var people = _DB.People.Where(p => p.Status == MyPersonEnum.STUDENT.ToString());
var ids = people.Select(p => p.Id);
var cars =…

Kirschstein
- 14,570
- 14
- 61
- 79
2
votes
1 answer
Generated SQL with PredicateBuilder, LINQPad and operator ANY
I previously asked a question about chaining conditions in Linq To Entities.
Now I use LinqKit and everything works fine.
I want to see the generated SQL and after reading this answer, I use LinqPad.
This is my statement:
var predProduct =…

Sig. Tolleranza
- 499
- 9
- 27
1
vote
1 answer
Should NHibernate generate SQL for GUID parameter without quotes?
Sql Server 2008 R2 Express. NHibernate 2.1.2.4.
I get SQL like:
SELECT customer0_.Id as Id1_0_
FROM customers customer0_
WHERE customer0_.Id=@p0;
@p0 = 11111111-1111-1111-1111-111111111111
...which returns 0 records even though there is Customer…
0
votes
1 answer
Rails 3.1 HABTM association with custom foreign_key generates wrong join statement
I've encountered a rather frustrating problem when trying to use has_and_belongs_to_many associations.
The scenario is as follows.
I have a product that has many news items associated and vice versa. News items can be translated to different…

Peter Piper
- 5
- 3
0
votes
2 answers
Hibernate generates error SQL like ".=."
I have 3 tables in Oracle DB which relationship is @ManyToMany. So I have 2 significant tables and one for mappings.
I create a classes with name (if you want I can show my classes) named Entities, Keywords (I understand that naming is not correct…

damintsew
- 88
- 9
0
votes
2 answers
How or where to remove generated SQL from tableadapter code?
I've been developing an app which uses strongly typed datasets and stored procedures. I've just graduated and this was the method that was sold to us as the way to go. I'm starting to have severe doubts.
My client has advised me that he might change…

spryce
- 616
- 7
- 14