update data append to another table data

Answered update data append to another table data

  • 25 Juli 2012 13:33
     
     

    hi all,

    this my structure

    tblAuther((Auther_ID,Auther_Name))

    tblArticle((Article_ID,Title,Auther_Name))

    the tblArticle Now Contain 30000 record I want Now replace The Auther_Name with Auther_ID.

    can any one help me?

Semua Balasan

  • 26 Juli 2012 5:48
     
     Jawab Memiliki Kode

    Hi,

    you can update your tblArticle using the script

    UPDATE A
    SET A.Auther_Name = B.Autherr_ID
    FROM tblAuther B
    JOIN tblArticle A
    ON A.Auther_Name = B.Auther_Name

    after that you can change the data type (if necessary) and change column name of Auther_name in tblArticle.

    * Note if there are two auther with the same name (and sure different ID) you need to review those authors for all other the update will do what you want.

    I hope this is helpful.


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid

    MCTS: SQL Server Administration/Development

    MyBlog