Answer: Answer:
The designation can be changed using below update statement. CHARINDEX() function will Searches an expression for another expression (Retail and Sales) and returns its starting position, Stuff() function inserts a string (Sales) into another string (designation column). It also deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position.
update employee set designation = Stuff(designation ,CHARINDEX('retail and sales',designation),16,'Sales') from employee where designation like '%retail and sales%'
Asked In: Interview |
Alert Moderator