?
Solved

Copying Tables in Fox 9

Posted on 2010-01-08
10
Medium Priority
?
196 Views
Last Modified: 2012-06-27
I have a table-table a I copy it to table b.   I look at table b and the names of some of the fields have been altered.  a filed called AVERAGEPRICES1  gets copied as AVERAGEPR1.  I tried the copy command and the copy structure command. Same thing  anyone run into this?

D

0
Comment
Question by:Malibucompany
  • 5
  • 3
  • 2
10 Comments
 
LVL 43

Accepted Solution

by:
pcelba earned 1332 total points
ID: 26211883
Standard DBF format allows field names up to 10 characters. When you add table to a database container then you can define field names up to 128 characters long (these names are not stored in DBF but in DBC). AVERAGEPRICES1 is 14 characters so it must be in database.

When you copy table included in database outside (the copy is a free table) then long field names must be substituted by the standard names.

To preserve long field names you have to specify DATABASE in COPY TO command.
0
 

Author Comment

by:Malibucompany
ID: 26212239
PCeba  Thank You

How would u use that command I cant get it to work keep getting errors

database name  is   databasea
table name is tablea

copy to tableb

Is is such an intricate program to fully learn it would take years it would seem  I appreciate your help. The books I have are all from FOX 6 and there always seems to be little pieces here and there that they leave out

Thank You

D
0
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 668 total points
ID: 26212292
OPEN DATABASE databasea
OPEN DATABASE databaseb
USE databasea!tablea
COPY TO tableb DATABASE databaseb

Add correct pathing to this. Add ...WITH CDX to the COPY command line, to also copy CDX. The database you copy to might also be the same database of course.

Bye, Olaf.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 43

Assisted Solution

by:pcelba
pcelba earned 1332 total points
ID: 26212343

*-- Tableb will be in the same database:
USE tablea
COPY TO tableb DATABASE databasea

*-- Tableb will be in the new database:
USE tablea
CREATE DATABASE databaseb
COPY TO tableb DATABASE databaseb
0
 
LVL 43

Assisted Solution

by:pcelba
pcelba earned 1332 total points
ID: 26212399
I agree WITH CDX but OPEN DATABASE command is not necessary.

If you need to transfer the new table somewhere outside of your PC or network then you have to copy all necessary files (both table and database - DBF, FPT, CDX and DBC, DCT, DCX)
0
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 668 total points
ID: 26263711
I think OPEN DATABASE is needes, as the DATABASE clause of the COPY TO command does not accept pathnames, only the database alias name, so you need to open the destnation database, and the source database is opened anyway, even, if you just use/open the source table.

Bye, Olaf.
0
 
LVL 43

Assisted Solution

by:pcelba
pcelba earned 1332 total points
ID: 26273482
Interesting, DATABASE clause in COPY TO accepts path in my VFP and simple "USE table" command does not open database even when the table is a part of it because I cannot MODIFY DATABASE after USE command but VFP knows about the database because you can use such database as a target of COPY command :-).

0
 

Author Closing Comment

by:Malibucompany
ID: 31674647
Works great thank you
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 26276614
Hi pcelba,

Okay, then I also learned something: COPY TO accepts database path. But I'm very sure USEing a dbf of a dbc does open the dbc, it's just not getting the active DBC, therefore MODIFY DATABASE fails.

CLOSE DATABASES ALL
?ADATABASES(laDBCs) && 0
USE seomdbf && dbf of a dbc
?ADATABASES(laDBCs) && 1

MODIFY DATABASE alone will still prompt with a file open dialog, because the database is not set active. DBC() does also still remain empty for the same reason. But simply use the database combobox in the standard toolbar of the VFP IDE and you'll see.

Bye, Olaf.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26276815
Yes, you are right. The database is open but not active. I just forgot we have SET DATABASE command... (and I've never used the combo).

Thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses
Course of the Month16 days, 16 hours left to enroll

862 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