Welcome to AC Web.
Results 1 to 9 of 9
  1. #1


    Join Date
    May 2008
    Location
    Land Called Finland.
    Posts
    658

    SQL Inserting help needed.


    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Hello Ac, I'm trying to insert multiple data at database so can someone help/guide me what i have to do so i don't need to do 1 by 1 steps.. :s

    I have multiple npcs guid what needs to insert into game_event_creature table but i only know how to do it one at the time but i need to know how i can insert multiple at one go.
    the values are: eventEntry and guid

  2. #2

  3. #3
    K A P P A L O U N G E

    Join Date
    Sep 2011
    Location
    Germany
    Posts
    2,425
    Hello there...

    Im not sure if i understand.. Guid requires npc are already spawned... So lets say ur a good dev or whatever and made the event-npc entryid order like always +1 after each other... You can make a call for all spawned event-npcs stored in creature table from ur spawn..

    Code:
    SET
    @EVENTID = -123;
    
    INSERT INTO game_event_creature (eventEntry, guid) SELECT @EVENTID, guid FROM creature WHERE id BETWEEN x AND y;
    You maybe replace x and y with your starting entryid and ending entryid of event-npcs to call from the creature table...? And your EventID with -123..
    Last edited by Psykko; 07-11-2019 at 04:31 PM.

  4. #4
    I don't know if i got what you are trying to say, and i think that i will answer you totally wrong, but well.. Could be an oportunity cause something similiar happened to me rsrs...

    Let's say that you are 100 .sql files that you want to import but you want to import them just one time.
    First, i don't know what is your DB Emulator, Heidi.. SQLyog.. MySQL Workbench, but it will help you for sure.
    Second:
    Start your CMD and type:
    Code:
     CD Example\exampleagain\pokemon\whatever\whereyourfilesare
    than you type that command:
    Code:
     type *.sql >> File.txt
    Than wait a moment, and let the command compact all of your files to one... Them search by the new file that you created (File.txt on our example), and rename it to File.sql, than import it...
    And that's all, if you have 817293817 files, than it will contact to one, and will be easy to import

  5. #5


    Join Date
    May 2008
    Location
    Land Called Finland.
    Posts
    658
    Quote Originally Posted by Psykko View Post
    Hello there...

    Im not sure if i understand.. Guid requires npc are already spawned... So lets say ur a good dev or whatever and made the event-npc entryid order like always +1 after each other... You can make a call for all spawned event-npcs stored in creature table from ur spawn..

    Code:
    SET
    @EVENTID = -123;
    
    INSERT INTO game_event_creature (eventEntry, guid) SELECT @EVENTID, guid FROM creature WHERE id BETWEEN x AND y;
    You maybe replace x and y with your starting entryid and ending entryid of event-npcs to call from the creature table...? And your EventID with -123..
    Hmm.. Good sir this is not what i had in my mind. What i trying to get / do is i have already npcs at world what are missing they eventid so i have this big massive list of those npcs guid like:
    135703
    133040
    133017
    133054
    133045
    133050
    133059
    133051
    133060
    133126
    133098
    133123
    133042
    133047
    133033
    and the list go's on... So i need some sort code that i can insert those all into game_event_creature db. eventEntry is 26 (aka Pilgrim's Bounty)

  6. #6
    Quote Originally Posted by dansku16v View Post
    Hmm.. Good sir this is not what i had in my mind. What i trying to get / do is i have already npcs at world what are missing they eventid so i have this big massive list of those npcs guid like:
    135703
    133040
    133017
    133054
    133045
    133050
    133059
    133051
    133060
    133126
    133098
    133123
    133042
    133047
    133033
    and the list go's on... So i need some sort code that i can insert those all into game_event_creature db. eventEntry is 26 (aka Pilgrim's Bounty)
    If you could have a parameter commun with every npc, like the mapID or something like that, you simple could

    Code:
     select * from creature where (id between x and y and mapId = M)
    than you have all of the rows listed, or even you could be more hardcore and use
    Code:
     position_x between coordx1 and coordx2
    its more like a filter thing

  7. #7


    Join Date
    May 2008
    Location
    Land Called Finland.
    Posts
    658
    Quote Originally Posted by leocalegario View Post
    If you could have a parameter commun with every npc, like the mapID or something like that, you simple could

    Code:
     select * from creature where (id between x and y and mapId = M)
    than you have all of the rows listed, or even you could be more hardcore and use
    Code:
     position_x between coordx1 and coordx2
    its more like a filter thing
    Hmm.. i think it could effect whole Elwynn forest npcs if i do this way i think? (Not sure)

  8. #8
    K A P P A L O U N G E

    Join Date
    Sep 2011
    Location
    Germany
    Posts
    2,425
    Quote Originally Posted by dansku16v View Post
    Hmm.. Good sir this is not what i had in my mind. What i trying to get / do is i have already npcs at world what are missing they eventid so i have this big massive list of those npcs guid like:
    135703
    133040
    133017
    133054
    133045
    133050
    133059
    133051
    133060
    133126
    133098
    133123
    133042
    133047
    133033
    and the list go's on... So i need some sort code that i can insert those all into game_event_creature db. eventEntry is 26 (aka Pilgrim's Bounty)
    Then my Query should do the Job. It select all guids from creatures entryids that are spawned (so i guess alot of creatures should be selected) which are then inserted with the eventid into your prefered table.... It doesnt select Guid and Insert it singulary... You may gotta read

    Cheers
    Last edited by Psykko; 07-12-2019 at 09:31 AM.

  9. #9

    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Quote Originally Posted by dansku16v View Post
    Hmm.. i think it could effect whole Elwynn forest npcs if i do this way i think? (Not sure)
    It's not like that, when i said "filters" it was to take care of it. But well, if you just want to add your Adds to your game_event_creature, it just follow psykko pass.
    Take your Ids, create a creature to them (It's about an insert thing like insert into `creature` VALUES (a,b,c,d,e)), than they will register their Guid (If they already have, it will resolve the problem). Than select on creature them like i did before but you only will need
    Code:
     select guid, entry from creature where (Your filters) group by guid
    take the guids ids. Than you will only replace the values where your ids are and set it to your eventEntry on the tble game_event_creature, but now with an INSERT INTO
    Last edited by leocalegario; 07-12-2019 at 04:17 PM.

 

 

Posting Permissions

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