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

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

Thank you very much for your reply.

Thank again. Its working now.

Regards,

Jov

Thank Again. Its Working.

Regards,

Jov

Don't mention it!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.