Home Sql Backup Into txt File



Backup Into txt File
Posted on: December 31, 2008 at 12:00 AM
Backup Into txt File is used to put the backup file from a table into a text File.

Backup Into txt File

     

Backup Into txt File is used to put the backup file from a  table into a text File.

Understand with Example

The Tutorial illustrate an example from 'Backup Into txt File'. To understand this example, we create a table 'Stu_Table' from which the Backup record is stored in a text file.  

Create Table Stu_Table

Create Table Stu_Table( Stu_Id int, Stu_Name varchar(15),Stu_Class());

Insert Data Into Stu_Table

Insert into adds the records or rows value to the table 'Stu_Table'

insert into stu_table values(1, 'Komal',10);
insert into stu_table values(2, 'Ajay',10);
insert into stu_table values(3, 'Santosh',10);
insert into stu_table values(4, 'Rakesh',10);
insert into stu_table values(5, 'Bhau',10);
insert into stu_table values(1, 'aaa',11);
insert into stu_table values(2, 'bbb',11);
insert into stu_table values(3, 'ccc',11);
insert into stu_table values(4, 'ddd',11);
insert into stu_table values(5, 'eee',11);
insert into stu_table values(1, 'iii',12);
insert into stu_table values(2, 'jjj',12);
insert into stu_table values(3, 'kkk',12);
insert into stu_table values(4, 'lll',12);
insert into stu_table values(5, 'mmm',12);

Stu_Table

+--------+----------+-----------+
| Stu_Id | Stu_Name | Stu_Class |
+--------+----------+-----------+
| 1      | Komal    | 10        |
| 2      | Ajay     | 10        |
| 3      | Santosh  | 10        |
| 4      | Rakesh   | 10        |
| 5      | Bhau     | 10        |
| 1      | aaa      | 11        |
| 2      | bbb      | 11        |
| 3      | ccc      | 11        |
| 4      | ddd      | 11        |
| 5      | eee      | 11        |
| 1      | iii      | 12        |
| 2      | jjj      | 12        |
| 3      | kkk      | 12        |
| 4      | lll      | 12        |
| 5      | mmm      | 12        |
+--------+----------+-----------+

Backup query 

The Backup query is used to copies the records from 'stu_table' and insert its records as backup into text file 'abc.txt'. The select statement is used to copy the records from table 'stu_table' into text file.

select * into outfile 'c:/abc.txt' 
from stu_table;

Backup successful ....

Related Tags for Backup Into txt File:
cfiletabletextbackupsedinttabtxttextoexteilbackputusefrominmntintoackskisxtssthabablomo


More Tutorials from this section

Ask Questions?    Discuss: Backup Into txt File  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.