熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL語言 >> 正文

用最簡單的步驟備份SQL數據庫的文件到本地

2022-06-13   來源: SQL語言 

  用最簡單的步驟備份sql數據庫的文件到本地:

  responseCharset = utf
  SessionCodepage =
  ResponseBuffer=true
  ResponseClear

  根據你的情況修改用戶名和密碼

  constr=Provider=SQLOLEDB;Persist Security Info=True;User ID=endiva;Password=endiva;Data Source=
  set conn=servercreateobject(adodbconnection)
  connopen constr
  bkfname=servermappath(Format_Time(Now())&databasebak)
  sqlstr=backup database fang to disk=+bkfname+ with init
  connexecute sqlstr
  connclose
  responseWrite database [fang] is backup success!
  
  responseWrite click download

  如果想直接備份並下載可以加上下邊的這部分就會備份後自動保存但是彈出的文件是asp的文件修改下就OK

  set fn=servercreateobject(adodbstream)
  fnmode= 讀寫
  fntype= 數據類型為adTypeBinary
  fnopen
  fnLoadFromFile bkfname 將bkfname指定的文件裝入對像中
  ResponseContentType=application/octetstream
  ResponseBinaryWrite fnread
  fnclose


From:http://tw.wingwit.com/Article/program/SQL/201311/16162.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.