[Advanced] Dump Query Results to .SQL File, help. menu

User Tag List

Results 1 to 5 of 5
  1. #1
    Pretzal's Avatar Member
    Reputation
    8
    Join Date
    Aug 2008
    Posts
    57
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Advanced] Dump Query Results to .SQL File, help.

    I'm pretty confident this is possible. What I want to do:
    Run a select query --> Send query results to .SQL file for later use


    Currently, i can use
    Code:
    select * from `characters` into outfile "D:\Dump.sql"
    Which *almost* does what I want it to do. Unfortunately, it fails to format the dump file in SQL, and thus rather than making its contents

    Code:
    INSERT INTO `characters` (column1, column2, ...) VALUES (row1, row2, ...);
    It just makes its contents the values with tabs inbetween e.g.
    Code:
    4   1   2   10000    500   465   8460 4,41,85,485   Frizire    6
    So my question is:
    How can I do something similar to a database dump, except only for a specific query, where I can re-execute the query from the file at a later date?

    [Advanced] Dump Query Results to .SQL File, help.
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Ermmm, I know SQLyog can do this but I have no idea what the actual command sequence is.

    I'll see if I can get it out of SQLyog later by looking at the logged queries. 7

    edit: nope, failed by only logging the selection and not the dumping.

    The only thing that might help might be:
    http://gilfster.blogspot.com/2005/11...s-to-file.html

    Or you could just get SQLyog or another program that can do this sort of thing in a GUI, lol.
    Last edited by stoneharry; 09-21-2010 at 02:09 AM.

  3. #3
    Pretzal's Avatar Member
    Reputation
    8
    Join Date
    Aug 2008
    Posts
    57
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I've had a look at that URL, and it gets me a little closer. Now I can get:
    "0","5","Frizire","2 43 1 0 0 4 0","0","2");

    Which is *almost* there. Now i'm just missing
    Code:
     INSERT INTO `characters` VALUES (
    at the start.

    But that lines terminated by '"', is there an equivilant? E.g. Lines started by "Insert into `characters` values (". I realise I could almost do this with the lines terminated by, making it

    Code:
    lines terminated by ");\r\n INSERT INTO `Characters` VALUES(
    Which would work for all but the first query, which at worst could be added manually I suppose. Any ideas on the 'lines started by' or something similar command?

    EDIT:
    And I think Navicat pro has it, ill have a look into it...

  4. #4
    adaephon's Avatar Active Member
    Reputation
    76
    Join Date
    May 2009
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    SELECT 'INSERT INTO '''characters''' (column1, column2, ...) VALUES (' + row1 + ', ' + CAST(row2 as VARCHAR) + ', ...)'
    FROM characters
    works in SQL Server

  5. #5
    Sonic Waffle's Avatar Contributor
    Reputation
    170
    Join Date
    Dec 2007
    Posts
    990
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    mysqldump -u username -p –all-databases > dump.sql
    or
    Code:
    mysqldump -u username -ppassword database_name > dump.sql
    Last edited by Sonic Waffle; 10-03-2010 at 09:07 AM.


Similar Threads

  1. Help with sql files.
    By macke013 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 06-14-2008, 08:54 AM
  2. Need help with orginal sql file!
    By Ollox in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 03-28-2008, 08:30 PM
  3. Help needed - how to insert .sql files with SQLyog
    By ADAMZY in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-23-2007, 05:32 PM
  4. [Help] Need some DB's and SQL files..
    By UnKnowN- in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 11-22-2007, 12:22 AM
  5. SQL file not working help please
    By n7e7b7 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 09-22-2007, 10:40 PM
All times are GMT -5. The time now is 03:52 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search