Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Statement in SQL
Message
 
To
27/02/2007 21:44:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01199411
Message ID:
01199418
Views:
15
>Hi Guys,
>
>I have a table that has around 100 columns. For each record, not all columns have values.
>
>Example :
>Row1 = Pkeyno, Column1, Column5, Column10, Column 15.... have values
>Row2 = Pkeyno, Column2, Column4, Column13, Column 114.... have values
>
>Is it possible to do a Select statement using the pkeyno as the where clause that would return all columns with values only?
>
>Thanks in advance....

The only way that I can see to do this is to make a first scan through the table, talking note of the fields that aren't empty and adding them as a comma delimited string expression in a new field. You could then do a second select, using macro expansion with the field list. You would have to use AS with each field to get set field names in the result set.

It is an ugly solution but I think that any solution is going to be ugly. With 100 fields it is going to be SLOW.

What is the actual business problem? It sounds like the data isn't being stored smartly if this type of extraction is required.
Cheers,
Jamie
Previous
Reply
Map
View

Click here to load this message in the networking platform