0

Guys,

How to make an scripts if itemnumber have no '-U' then i will place this on the right side while
if there's an exising '-U' then no replacement to be done.

ItemNumber
------------------
P300-4410-DROIDERIS
P300-4110-TOUR
P333-4410-EVO-U
P333-4129-8530PUR-U
P333-4170-9330GRY-U
P333-4110-8350-U

RESULTS:
ItemNumber
------------------
P300-4410-DROIDERIS-U
P300-4110-TOUR-U
P333-4410-EVO-U
P333-4129-8530PUR-U
P333-4170-9330GRY-U
P333-4110-8350-U

Thank you

JOV

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by jbisono
0

If you dont want to filter out just the items that does not have a -U then you can do this. I'm assuming that the '-U' is always at the end.

SELECT CASE WHEN SUBSTRING(ItemNumber, LEN(ItemNumber) - 1, 2) = '-U' THEN ItemNumber ELSE ItemNumber + '-U' END AS MyNewItemNumber
From YOURTABLE
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.