|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I just needed the column list of the resulting query for a field picklist,
so I surrounded the original query AABB by SELECT * FROM (AABB) T WHERE FALSE But unfortunately this fails if the original query AABB was segmented... (multiple SQL statements like creating an index and then returning data using a select statement) So I decided to change all the SELECT keywords into SELECT TOP 0 and then returning the query result. But hey, this is strange: I get ALL records back? SELECT TOP 1 returns one record, SELECTR TOP 2 returns two records, but SELECT TOP 0 returns all records? Bug or WAD? Regards - hans |
|
#2
|
|||
|
|||
|
SELECT TOP 1 * FROM "EMET_EM"
takes 16 ms SELECT * FROM "EMET_EM" WHERE FALSE takes 33703 ms (Table with 1.6M records, 12 columns) Any explanation? Regards - Hans |
|
#3
|
|||
|
|||
|
Hans Hasenack wrote:
> SELECT TOP 1 * FROM "EMET_EM" > > takes 16 ms > > SELECT * FROM "EMET_EM" WHERE FALSE > > takes 33703 ms > > (Table with 1.6M records, 12 columns) > > Any explanation? > > Regards - Hans > > If you have an AUTOINC field, try the following: SELECT * FROM Table WHERE RecordID = 0 Where RecordID is your AUTOINC field. Best regards, Shane |
|
#4
|
|||
|
|||
|
Unfortunately the SQL statement is entered by the end user, so I need the
fieldlist before i can determine wheter there is an autoincfield ;> regards - Hans |
|
#5
|
|||
|
|||
|
there is SELECT ALL ...
there is SELECT DISTINCT ... there is SELECT TOP n .. so why isn't there SELECT NONE ... Just because it isn't in the SQL 2003 defenition? I'd even like it better if TnxQuery.Prepare would initialize FieldDefs but hey, That is moved to the v3 version Regards - Hans |
|
#6
|
|||
|
|||
|
Hans,
> SELECT TOP 1 * FROM "EMET_EM" > > takes 16 ms Because the TOP clause makes the result non-live. > SELECT * FROM "EMET_EM" WHERE FALSE > > takes 33703 ms > > (Table with 1.6M records, 12 columns) > > Any explanation? I think this is only a problem with "live" queries. Request a non-live query (set RequestLive to false) and you should get the result instantaneously. Ole |
|
#7
|
|||
|
|||
|
Hans,
> so why isn't there SELECT NONE ... > > Just because it isn't in the SQL 2003 defenition? The problem you've experienced has nothing to do with the SQL:2003 specification. See my other reply. Ole |
|
#8
|
|||
|
|||
|
Ole, the original problem is that I do not really want to execute a query,
but I actually only want the field list it produces. Since FieldDefs.Update executes the entire query (and thus may take a long time), I turned to changing the query SQL statement in tat it produces no results, which produces my results a lot faster. While doing this, I investigated some alternate options and came through this path. Anyway you were right, requesting the query with LiveDataset=False took only 0 ms ![]() Hans |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Returning result sets using a stored procedure | Grant Brown | nexusdb.public.support.sql | 3 | 29th August 2006 04:28 PM |
| Deliberately return an EMPTY ResultSet from a Query | Dennis Landi | nexusdb.public.support.sql | 6 | 31st January 2006 07:19 AM |
| Result Fields are empty | Bernhard Roos | nexusdb.public.support.sql | 6 | 3rd December 2005 04:31 AM |
| 2.04 preview not returning data | Thomas Lohrum | nexusdb.public.support.sql | 1 | 20th October 2005 01:06 PM |
| Query not returning the correct dataset. | Rodrigo Gómez [NDX] | nexusdb.public.support.sql | 4 | 21st July 2005 02:19 AM |