隨筆-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

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 乐山市| 虞城县| 陈巴尔虎旗| 麦盖提县| 大竹县| 江西省| 罗源县| 兴义市| 颍上县| 金昌市| 龙井市| 冷水江市| 万山特区| 孟村| 鄯善县| 肥乡县| 乐亭县| 庆阳市| 台湾省| 盐山县| 晋宁县| 汤阴县| 四子王旗| 中卫市| 陆河县| 苏尼特右旗| 垦利县| 新巴尔虎左旗| 融水| 江陵县| 平遥县| 吉水县| 津南区| 固始县| 丁青县| 股票| 微山县| 抚州市| 鄢陵县| 巴东县| 焦作市|