Dump data into a text file : Save To Text File « Backup Load « SQL / MySQL






Dump data into a text file

       
mysql>
mysql>
mysql>
mysql> CREATE   TABLE TEAMS
    ->         (TEAMNO         INTEGER      NOT NULL,
    ->          EmployeeNO       INTEGER      NOT NULL,
    ->          DIVISION       CHAR(6)      NOT NULL,
    ->          PRIMARY KEY    (TEAMNO)             );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
mysql> INSERT INTO TEAMS VALUES (1,  6, 'first');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO TEAMS VALUES (2, 27, 'second');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT   *
    -> FROM     TEAMS
    -> INTO     OUTFILE 'C:/TEAMS.TXT';

mysql>
mysql> drop table teams;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Backup records into txt file
2.Backup table records into txt file: indicate terminator
3.Set OPTIONALLY ENCLOSED
4.set ENCLOSED terminator
5.Escape sign
6.Create dump file
7.Add null value to dumped file
8.Dump data into text file and change the default terminators
9.Change the terminator for fields
10.Change the ternimator for lines
11.Exporting Data to a Dump File
12.Adding an ESCAPED BY subclause:
13.LINES subclauses.
14.To put the rows on separate lines, you must modify the TERMINATED BY subclause
15.Terminates each line with <>
16.To export the passwd table in CSV format with CRLF-terminated lines, use this statement:
17.Exporting Data Out of a Table