question

rico33126 avatar image
rico33126 asked

How to update the last 3 characters in a column in a table

Hello there I am trying to update the last 3 characters in a column (Empname) in a table (Employees) EmpID Empname 1 Leo Llc 2 George Llc so that it look like the following: Leo, LLC George, LLC I am using the following query but it is not producing the desired results UPDATE Employees SET empname= SUBSTRING(empname,4,3)+ ', LLC' WHERE RIGHT(empname,3) = 'Llc' Thanks in advance for the help Rio
characters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jpatchak avatar image
jpatchak answered
UPDATE employees SET employees.empname = LEFT(employees.empname, CHARINDEX(' LLC', employees.empname, 1)-1) + ', LLC' WHERE RIGHT(employees.empname, 3)='Llc'
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rico33126 avatar image
rico33126 answered
Thank you for your answer It worked great ,Thank you for your answer. It worked great Rio
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.