Import local TXT files to a remote SQL Server database

Source: Internet
Author: User

Websites generally place databases and web servers separately as two servers. In this case, if the TXT files on the web server are used as the data source, you need to import the data to the database server.

If the Web server is installed with SQL, you can use the BCP method to import data, which is highly efficient.

Here we will discuss how to import data without installing SQL on the web.

You can create an Access database locally and use it as a springboard for data import.

DetailsCodeAs follows:

Select   *   Into   [ ODBC; driver = SQL Server; server = XXX. XXX; uid = xx; Pwd = xxx; database = xxx ] . Aimtable From   [ Text; HDR = no; database = D :\ ] . [ Fountain # txt ]

For convenience, I used select into. aimtable is the name of the table to be created, and D: \ is the folder where the file is stored. Here I put it under the root directory of drive D, and fountain is the file name, TXT is a file type.

With such a statement, you can import local file data to a remote database.

Related Article

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.