SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Insert query Question

    Hi Friends,
    I have a sql file with a very big insert query.When I try to enter this in mysql prompt it throws error.I dont want to divide it up and then enter,that might cause some human errors.Can somebody please tell me how to automate this.
    Thanks

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Post The Error!

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    It doesn't shows me any particular error...but it is so big(2000 records)...that it stops after reachin a certain limit.... I copy it and when i paste it in command prompt it stops midway like this:
    This is the query:
    INSERT INTO `table_name` VALUES ('xyz','',...........),('abc','',...........)........('zzz','',...........);

    I run this at this prompt:
    mysql>INSERT INTO `table_name` VALUES ('xyz','',...........),('abc','',...........)........(


    and it stops..and i need to press ctrl+c to get out.If I break it into 20 smaller queries it works fine.
    Please help friends.
    thanks

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    that's too much for one insert query. you should either do one insert per query, or limit it to a smaller number like 10 or 20.

    you MIGHT be able to insert that in one query if you up the max_packer_size server variable.


Bookmarks

Posting Permissions

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