2014-03-30 31 views
0

請幫我複印結構和特定的列數據,我有大數據庫DBF,其中有34列和超過50,000個記錄。 在這種情況下,我需要10列僅由34列。邏輯上,如果我刪除不需要的列將減少數據加載。 所以我會從源文件複製具體列的結構和數據,但我不知道如何在Visual FoxPro中做到這一點。如何在Visual FoxPro中

你幫我這種情況?

之前和之後,感謝您的關注閱讀我的問題。

問候,

發性

回答

3

使用以下格式:

SELECT col1,col2,col3,col4,col5,col6,col7,col8,col9,col10 FROM table1 INTO TABLE table2 
0

如果你只是想永久刪除列第一,爲咧嘴一笑,使文件的備份副本。然後,確保您沒有使用該表的任何程序並啓動VFP。在命令窗口中,輸入

USE C:\SomePath\YourTable EXCLUSIVE {enter} 

*/ Now, get the one column you want copied out... you can just add as many 
*/ Columns, such as any primary key reference you may also want to include to. 
COPY TheOneColumnYouWant to C:\SomePath\NewTableForThisColumnOnly {enter} 

*/ Now, to remove the column from the original table, now that is has been moved 
*/ to the "other" table. 
MODIFY STRUCTURE {enter} 

這會調出一個修改表結構,您可以在其中更改/刪除任何列。將列表向下滾動到要刪除的列,然後在底部單擊DELETE按鈕,然後單擊確定按鈕確認結構更改。然後它會返回確認提示「使結構更改永久?」並選擇是。列現在消失了。

在VFP刪除列的替代,您可以使用ALTER TABLE通過......

ALTER table C:\SomePath\YourTable DROP COLUMN TheOneColumnYouWant 
+0

感謝答覆的先生,我不明白我命令「將TheOneColumnYouWant複製到C:\ SomePath \ NewTableForThisColumnOnly」。其實我試試,「COPY column1,column2,column3,column4,column5,column6,column7,column8,column9,column10 to NewTableName」,但是messagebox出現「command contains unrecognized phrase/keyword」。 – Pathic

+0

@Pathic,我提供的命令是EXAMPLES。你需要把自己的路徑和任何你想要的列。如果你做的是「列表結構」,那麼這些就是你要查詢/複製的列名。 – DRapp

+1

語法是:COPY TO NewTableName FIELDS column1,column2,column3 – LAK