Re: [SQL ] 將SQL資料轉成txt檔?
※ 引述《zxc321 (堅持到底 )》之銘言:
: 各位版友好
: 請問我的資料庫裡的某個表單裡有約250萬筆資料
: 我要如何將他複製轉成txt檔呢?
如果是 MySQL,請執行 select ... into outfile ... 指令,可匯出資料成
普通文字檔,例如:
select categoryId, categoryName
into outfile 'c:\\temp\\lab.txt'
fields terminated by ',' enclosed by '"'
lines terminated by '\r\n'
from categories;
如果是 SQL Server,Express 版也附有資料匯入/匯出精靈,滑鼠右鍵點按
資料庫 | 工作 | 匯出資料。另外,也請 Google 一下 bcp 工具程式,它也
蠻好用的。
Oracle,以 SqlPlus 連結後,變更以下設定:
set colsep ','
set head off
set pagesize 0
然後,以 spool 指定輸出檔案,例如:
spool c:\temp\test.txt
接下來,執行的 select 指令結果就會匯出到 c:\temp\test.txt
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.41.107.13
討論串 (同標題文章)