I want to insert values from data table to emp table

  • Hi,

    I have a situation where I need to insert rows from data table to emp table. If the status in data table is "0" - I want "Inactive" for the same field in the emp table. If the status in the data table is "1" - I want "Active" for the same field in the emp table. If the status in the data table is "2" - it should be "Withdrawn" in the emp table.

    Please some one could help me?

    Regards,

    Hema

  • You can do a couple of different things to accomplish this.

    The best would be to make a table that has your values in it, and join to that table in your Select statement.

    What code do you have for the Insert so far?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi,

    my problem is resolved.

    yes I have joined the tables. I could solve that by using case in the select statement.

    Thanks,

    Hema

  • Yes, a case statement is another option.

    I don't like to use them when a table can be used, because changing data in a table doesn't require rewriting code, but changing case statements does. And if there's one thing I'm accustomed to, it's changes in the rules.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply