how to update record in sql server

  • hi friends i have small doubt in sql server plz tell me how to solve.

    table data contains like

    tablename: emp

    id , designation ,department

    1 , abc(sales) , marketing

    2 , ram(analysis) , finance

    3 , banu(sales) , hr

    based on that table whose designation 'sales' that must be change 'marketing'

    output like

    table: emp

    id , designation ,department

    1 , abc(marketing) , marketing

    2 , ram(analysis) , finance

    3 , banu(marketing), hr

    i try to useing update statement like

    update emp set designation=

    case designation when 'sales' then 'marketing' end

    but its not given exactely output.plese tell me query how to solve this issuse in sql server

  • UPDATE TABLE emp SET designation = REPLACE(designation, '(sales)', '(marketing)')

    WHERE designation like '%(sales)%';


    Dird

Viewing 2 posts - 1 through 1 (of 1 total)

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