SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Always learning viveknarula's Avatar
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Altering multiple tables

    hi,
    pls tell me can we alter multiple tables with one query ?
    e.g i have 2 tables t1 and t2 i want to add auto increment feature on primary keys of these tables.

    i was using

    ALTER TABLE `t1` ,
    't2' CHANGE `column1` ,
    'column2' `column1` INT( 11 ) NOT NULL AUTO_INCREMENT ,
    `column2` INT( 11 ) NOT NULL AUTO_INCREMENT


    Pls suggest some solution

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,215
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    i think you need to use separate ALTER statements for each table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Always learning viveknarula's Avatar
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    i think you need to use separate ALTER statements for each table

    That i can do but i have (app) 100 tables to alter.

    PLS help

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Write a small script that gets the table list and issues the query for every table.


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
  •