MySQL select into, SQLServer select

Source: Internet
Author: User

The following articles mainly introduce MySQL select into and SQLServer select, we all know that the MySQL database does not support the structure of the direct backup table for the Select Into statement and the actual application data. As a result, you need to find a method on the Internet to replace it, there are other methods to deal with, summarized as follows:

Method 1:

MYSQL does not support:

 
 
  1. Select * Into new_table_name from old_table_name 

Alternative method:

 
 
  1. Create table new_table_name (Select * from old_table_name); 

Method 2:

1. Back up the table structure and data first.

Export command-u user name-p password-h Host IP Address Database Name table name 1> export file. SQL

 
 
  1. mysqldump -uroot -proot -h192.168.0.88 ok_db oktable2 > ok_db.sql 

2. Modify the name of the backup table

3. log on to MySQL

4. Select a database

5. Run the following command: Source backup table path: Source d: \ OK _db. SQL, and press Enter.

6. Complete.

SQLServer supports MySQL Select into statements

1. Run the following command to back up the table.

 
 
  1. Select * Into new_table_name from old_table_name; 

MySQL Select into outfile is used to export the specified data to the file:

1.export all data in the table to the cdisk root directory outfile.txt as follows:

 
 
  1. Select * into outfile 'c:\\outfile.txt' from test; 

2. In the export table, specify the data with the query Condition No. 2005-06-08to the cdisk root directory outfile1.txt as follows:

 
 
  1. Select * into outfile 'c:\\outfile.txt' from test where beginDate='2008-06-08'; 

Source: Baidu
 

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.