用我寫的軟體可以用excel匯入到postgresql,你上網找fitreport就行了。
或者這樣做:
可以寫語句或採用以下的方法
網上轉錄下來的方法:
步驟:
1.將excel表格欄位,按照postgresql資料庫中表的欄位順序來整理資料,並儲存為csv檔案。
2.用記事本開啟csv檔案,另存為utf-8格式。
3.使用pgadmin客戶端連結postgresql資料庫,執行如下指令碼,匯入csv檔案到postgresql資料表:
copytestdatafrom"d:/test/testdata.csv"delimiteras","csvquoteas"""
注:testdata是postgresql資料庫表的名稱。
注意事項:
1.test目錄需要賦予postgres使用者可讀寫的許可權,否則會有如下報錯資訊:
error:couldnotopenfile"d:/testdata2.csv"forwriting:permissiondenied
2.csv檔案要為utf-8格式,否則匯入時可能會有報錯:
error:invalidbytesequenceforencoding"utf8":0xcdf5
3.注意windows環境下檔案路徑的表述方式,如:d:/test/data.csv
用我寫的軟體可以用excel匯入到postgresql,你上網找fitreport就行了。
或者這樣做:
可以寫語句或採用以下的方法
網上轉錄下來的方法:
步驟:
1.將excel表格欄位,按照postgresql資料庫中表的欄位順序來整理資料,並儲存為csv檔案。
2.用記事本開啟csv檔案,另存為utf-8格式。
3.使用pgadmin客戶端連結postgresql資料庫,執行如下指令碼,匯入csv檔案到postgresql資料表:
copytestdatafrom"d:/test/testdata.csv"delimiteras","csvquoteas"""
注:testdata是postgresql資料庫表的名稱。
注意事項:
1.test目錄需要賦予postgres使用者可讀寫的許可權,否則會有如下報錯資訊:
error:couldnotopenfile"d:/testdata2.csv"forwriting:permissiondenied
2.csv檔案要為utf-8格式,否則匯入時可能會有報錯:
error:invalidbytesequenceforencoding"utf8":0xcdf5
3.注意windows環境下檔案路徑的表述方式,如:d:/test/data.csv