Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy data from table A to table B and add a field
Message
From
03/05/2004 11:58:59
 
 
To
30/04/2004 18:56:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00899769
Message ID:
00900420
Views:
15
>>Enviroment VFP 7, existing tables on a Novel server, new tables on a local PC running Win2k.
>>
>>I have several tables which have an addition field. The new tables have test data in them. The new field is 1 character and has values A and B. I need to do the following:
>>
>>1. remove existing test data
>>2. copy existing data and set new field to A
>>3. copy existing data and set new field to B and set 3 numeric fields to zero
>>
>>What is the safest way to the do the above?
>
>
Select *, "A" as NewFieldName from RemoteTable into table LocalTable
>
>...and variants thereof. In the next line you can also
>
select LocalTable
>Blank All Fields num1, num2, num3
>- which will set your three numeric fields to zero (insert your real table and field names here, of course).
>After this, you may need to open the local table exclusively to index it.

thanks for repsonse, but it does not seem to do what I need which is to do.

1. remove existing data from tables
2. either copy a copy of existing version of the data from an existing table adding the new fileld
3. or make copies of the existing data where 1st copy has new fileld added with value A and 2sd copy has copy of the existing data with a new field added with a value of B and the value of one or more the existing fields set to zero.

I thought the above select statement creates a new table. That is OK if can get multiple copies of the data and then set some fields initaliazied to zero ONLY if new filed is B.

Thanks for pointer to BLANK command, I did not know about it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform