Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 686
  • Last Modified:

vfp9 Select * Command field name in correct

Hi experts
I have a table called  customer and it has field email_offer
when i use the following

select * from customer into table temp

when I open table temp it has field
                                                         email_offe

r is missing of that field.

Please help
0
b001
Asked:
b001
4 Solutions
 
peterhuppCommented:
Is it a free table?  Long file names need to be part of the DBC.  

See "How to: Name Fields" in vfp help

You specify names for fields as you build a table. For free tables, field names can be up to 10 characters long. For database tables, field names can be up to 128 characters long.

So if your customer table was inside the DBC the query would show the long file names
0
 
Olaf DoschkeSoftware DeveloperCommented:
Select INTO CURSOR and the field name will not be truncated. Selecting INTO TABLE creates a free table, which only can have short field names.

Bye, Olaf.
0
 
pcelbaCommented:
You may simply place the output table into some temporary database:

CREATE DATABASE SYS(2023) + '\TempDatabase'
select * from customer into table temp DATABASE TempDatabase
BROWSE

If you create a cursor instead of the table then you may use long field names without database creation.
0
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!

 
b001Author Commented:
my table customer is part of a dbc

when I copy it to cursor like

select * from customer into cursor test

it is ok. it does have full field name

but when I copy it to a table

select * from customer into table temp

all the field name are  10 character.

Please help
0
 
Olaf DoschkeSoftware DeveloperCommented:
You already have the answer, why it's that way.

There is no way to change the limitations of free tables, so if you need a DBF with the same field name, first create a DBC and add the DATABASE clause, as in Pavels answer. You may also simply USE customer, and then COPY TO, also using the DATABASE clause.

Bye, Olaf.
0
 
pcelbaCommented:
One question: Why do you need the temp table?

VFP offers cursors which are much better for temporary use. Tables are derived for permanent data storage where the name "temp" is not so relevant probably... Could you imagine several processes each one creating the temp.dbf? Of course, it is OK for this simple testing purpose.

So, to create the table having long field names you will need to open or create a database container (DBC) which preserves long field names (field names stored in the table are still 10 chars max).

Theoretically you could use the same database which is used for customer table but the temp table creation in this database would mean the garbage creation which is not good practice.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now