Stefan Motz
asked on
T-SQL: Is there a better way to write 'where column_name like '%CS?
Hi Experts,
I would like to do an update. What would be the best way to do it if mail_cd is always 5 characters and I'd like to capture the last two characters only? This is how I'm doing it now but I'm curious if there is a better way to do it:
update Employees set Department ='Customer Service' where mail_cd like '%CS'
I would like to do an update. What would be the best way to do it if mail_cd is always 5 characters and I'd like to capture the last two characters only? This is how I'm doing it now but I'm curious if there is a better way to do it:
update Employees set Department ='Customer Service' where mail_cd like '%CS'
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all!
Thanks for the split. Good luck with your code. -Jim
@Jim: Yup, LIKE 'xyz%' can use an index seek.
If so, good to know, learn something new every day..