Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Question Unanswered: Exporting data from mysql to Existing txt file.

    Hi, Can someone please guide me about database export..
    i wanted to export MySQL db Table fields to txt file such a format, that should get assign into a different existing columns of an existing txt file and it should separated by "comma and space"
    Eg:
    col1 = field1, field2, ......
    col2 = field3, field4, ......

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002

  3. #3
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Why not perform an UPDATE on the table?

    If you using session variables as follows:

    Code:
    mysql> select * from updatefields;
    +------+------+
    | f1   | f2   |
    +------+------+
    |    0 |    1 | 
    |    2 |    3 | 
    |    3 |    4 | 
    +------+------+
    3 rows in set (0.00 sec)
    
    mysql> update updatefields set f1=@f1:=f1, f1=f2, f2=@f1;
    Query OK, 3 rows affected (0.00 sec)
    Rows matched: 3  Changed: 3  Warnings: 0
    
    mysql> select * from updatefields;
    +------+------+
    | f1   | f2   |
    +------+------+
    |    1 |    0 | 
    |    3 |    2 | 
    |    4 |    3 | 
    +------+------+
    3 rows in set (0.00 sec)
    Last edited by it-iss.com; 04-30-12 at 09:23.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  4. #4
    Join Date
    Apr 2012
    Posts
    2
    Thank you,

    I dont want to update fields rather than need to export(asign) database values into one list name "values" which is already present in My Text file .

    Eg: Let "values" is one column in my sql table "values_tb" and val1, val2, val3 are the values of column, these values i need to assign into one list name called as "values" which is present in My Text file.

    o/p which i need to get in

    My Text file:

    Myfile.txt
    _______________________
    | |
    |values = val1, val2, val3 |
    | |
    | |
    | |
    | |
    |______________________|

    please help me out....

  5. #5
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    If the file already exists and you want to update entries in this file with values from queries then this is not possible from MySQL directly. However, this can be done by developing the update in the file of the values through some programming language (PHP, Java, C++).
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •