Solved

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

Posted on 2013-05-10
6
535 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
  • 4
6 Comments
 
LVL 40

Expert Comment

by:Sharath
Comment Utility
Post your original and the modifed queries.
0
 
LVL 25

Expert Comment

by:Sinisa Vuk
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 21

Author Comment

by:developmentguru
Comment Utility
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
Comment Utility
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
Comment Utility
I found a solution to the problem and posted it so others would be able to benefit from it.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now