[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

DBX TSQLQuery results missing fields that are defined to always return null

Posted on 2013-05-10
6
Medium Priority
?
549 Views
Last Modified: 2013-07-22
I have defined a query to return 15 columns.  This is one of several where I have designed the queries to return like data from different tables.  In some tables there is a field for full name.  In others there are fields for First Name, Middle Initial, and Last Name.  I have the routine that uses these fields set to see if the name parts are defined.  If they are not then it reads the Full Name field and breaks out the name.

All of this has been working well.  As I added a new query to the list I found I did not have all of the fields defined.  I added the new fields to the query as:
null FirstName,
null MiddleInitial,
null LastName,

Now when I run the query, all of the fields that will always return null are missing (not in the fields list)!

I am looking for a way to make this TSQLQuery.Open statement return all of the fields.
0
Comment
Question by:developmentguru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 41

Expert Comment

by:Sharath
ID: 39156642
Post your original and the modifed queries.
0
 
LVL 28

Expert Comment

by:Sinisa Vuk
ID: 39157013
Agree, post it here. My guess goes to this - force type cast for fields like:

cast(null as varchar(100)) as FirstName,
cast(null as varchar(100)) as MiddleInitial,
...
0
 
LVL 21

Author Comment

by:developmentguru
ID: 39163427
The queries are working.  I have one row of data in my result set.  I set an index by name (using the IndexName property) and the one record I have now shows as 0 records.

The data is in a TClientDataset.  You can get data into those without a query, which I am doing here.  I create my dataset independently of several queries, then I add the query results to the client dataset.

using the client dataset I am running into issues.  I have 5 indexes setup from the time I create the dataset (before I add the data).  At one point in the program I run a command like

fCDS.IndexName := 'idxPersonalEmail';

And watch.  Before running that line I have 1 record.  After running it I have 0 records.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 21

Author Comment

by:developmentguru
ID: 39163430
I didn't mention it, but this is being done for a company that is very much against upgrading... it is being done in Delphi 2007.
0
 
LVL 21

Accepted Solution

by:
developmentguru earned 0 total points
ID: 39332939
The routine was using the client dataset within a loop.  I was able to get this working by recreating the client dataset every time I used it.  When the client dataset is recreated each time, before adding the data and setting the index, the setting of the index does not cause the record to disappear.
0
 
LVL 21

Author Closing Comment

by:developmentguru
ID: 39345419
I found a solution to the problem and posted it so others would be able to benefit from it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question