How do I back up SQL database files to a local machine?

Source: Internet
Author: User
Back up the SQL database file locally with the simplest steps: response. Charsetutf-8Session.Codepage65001Response.BuffertrueResponse.Clear modify the user name and password constrProviderSQLOLEDB.1; PersistSecurityInfoTrue; UserIDendiva; Passwordendi according to your situation

Back up the SQL database file to the local device using the simplest procedure: response. charset = UTF-8 Session. codepage = 65001 Response. buffer = true Response. clear' modify the User name and Password according to your situation constr = Provider = SQLOLEDB.1; Persist Security Info = True; User ID = enpa; Password = endi

Use the simplest steps to back up SQL database files to the local machine:

Response. Charset = "UTF-8"

Session. Codepage = 65001

Response. Buffer = true

Response. Clear

'Change the user name and password based on your situation

Constr = "Provider = SQLOLEDB.1; Persist Security Info = True; User ID = enpa; Password = enpa; Data Source = 211.160.78.6"

Set conn = server. createobject ("adodb. connection ")

Conn. open constr

Bkfname = server. mappath (Format_Time (Now (), 5) & "database. bak ")

Sqlstr = "backup database fang to disk = '" + bkfname + "' with init"

Conn.exe cute sqlstr

Conn. close

Response. Write "database [fang] is backup success!

"

Response. Write "click download"

If you want to back up and download the data directly, you can add the following part to save the backup automatically. However, the pop-up file is a. asp file. Modify the file and click OK.

'Set fn = server. createobject ("adodb. stream ")

'Fn. mode = 3' read/write

'Fn. type = 1' data type: adTypeBinary

'Fn. open

'Fn. LoadFromFile bkfname': mount the file specified by bkfname to the object

'Response. ContentType = "application/octet-stream"

'Response. BinaryWrite fn. read

'Fn. close

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.