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 12:27:18
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
03/05/2004 11:58:59
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00899769
Message ID:
00900429
Views:
33
>>
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.

1. zap command would do that - but since it's so destructive, backup first.
2. my select command is doing that
3.a. play with it and you can achieve what you need, though not in one command. This is just to get you started.
3.b.
select LocalTable
Blank Fields num1, num2, num3 for somefield="B"
Select command does create a new table if you have a "into table ..." clause. Or it can have a few other destinations, look it up in help. It's quite powerful and can do a lot.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform