Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, community. You piece of advice will be very useful! How to execute "ALTER TABLE" for a lot of tables in database? I'm going to change engine from MyISAM to ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    7

    execute `alter table` for a lot of tables

    Hello, community.
    You piece of advice will be very useful!
    How to execute "ALTER TABLE" for a lot of tables in database? I'm going to change engine from MyISAM to NDBCLUSTER. There are several hundreds of tables in database.
    Command like
    Code:
    ALTER TABLE * ENGINE=NDBCLUSTER
    isn't working.
    I believe in your help!

    Regards,
    self_ru

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    In standard SQL there is no way to do this. You need to do it with a stored procedure. For example, in Oracle you could write a PL/SQL procedure to do it, and with Sybase or MS SQL Server you could write a Transact-SQL procedure to do it. I don't know what MySQL provides for a stored procedure language, but I'm sure you can do it there. You can also generate a script that has an alter statement for each table and then execute that.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    7
    Rubberman, thank you very much for answer. I'll know now about it

    Regards,
    self_ru

Posting Permissions

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