Solved

vfp9 Select * Command   field name in correct

Posted on 2013-01-05
6
642 Views
Last Modified: 2013-01-07
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
Comment
Question by:b001
6 Comments
 
LVL 3

Expert Comment

by:peterhupp
ID: 38747041
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
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
ID: 38747072
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
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 250 total points
ID: 38747075
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:b001
ID: 38747105
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
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
ID: 38747118
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
 
LVL 41

Accepted Solution

by:
pcelba earned 250 total points
ID: 38747168
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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