隨筆-4  評論-0  文章-0  trackbacks-0
          從數據庫中把所有表數據導出: 
          1.編輯一個文件selectout.sql: 
          set nocount on
          use databasename
          go
          select 'bcp databasename..' + name + ' out d:\temp\' + name + '.txt -Uusername -Ppassword -Sservername -c ' from sysobjects where type='U'
          go
          2.在cmd中執行: 
          isql -Uusername -Ppassword -Sservername -i d:\selectout.sql -o d:\bcpout.bat
          3.執行d:\bcpout.bat文件, 可以把數據導出到d:\temp\目錄。 
          把所有表數據導入到數據庫時,將上面的out改為in 

          4.bcp導入導出: 
          導出數據:
          bcp DatabaseName.dbo.tableName out D:\tableName.txt -SServerName -Usa -P -c -b 10000
          導入數據:
          bcp DatabaseName.dbo.tableName in D:\tableName.txt -SServerName -Usa -P -c -b 10000
          在導入大量數據時加上-b參數,分批提交不以致于數據庫日志被塞滿。 
          posted on 2012-04-24 14:16 cuilihui 閱讀(2537) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2012年4月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 仁怀市| 清徐县| 鄂托克前旗| 丰都县| 迁安市| 绥江县| 武冈市| 西和县| 枣强县| 洛阳市| 垫江县| 宁南县| 无极县| 西和县| 巴马| 金塔县| 南投县| 石家庄市| 房产| 富蕴县| 祥云县| 鲁山县| 讷河市| 湾仔区| 商丘市| 泰来县| 大竹县| 来安县| 台东县| 驻马店市| 沭阳县| 石景山区| 砚山县| 英山县| 杂多县| 兴隆县| 东阳市| 安岳县| 壤塘县| 平安县| 出国|