Hello
I'm working on a stored procedure to update a field with an Alpha Character (e.g. X) at the end. I want to only update if the right character of the field in not already a letter (alpha character). I do not want to end up with multiple letters at the end of the number (e.g ##########XXX)
Right now I have it hardoced to X but the end user could select another letter to update the number with.
Is there a way to check insted of != 'X' have it check where != A-Z?
Here is my code so far
Thanks in advance
I'm working on a stored procedure to update a field with an Alpha Character (e.g. X) at the end. I want to only update if the right character of the field in not already a letter (alpha character). I do not want to end up with multiple letters at the end of the number (e.g ##########XXX)
Right now I have it hardoced to X but the end user could select another letter to update the number with.
Is there a way to check insted of != 'X' have it check where != A-Z?
Here is my code so far
Code:
UPDATE SHIPPING_CONTAINER SET
SHIPPING_CONTAINER.CONTAINER_ID = SHIPPING_CONTAINER.CONTAINER_ID + @CHARACTER
WHERE
RIGHT(SHIPPING_CONTAINER.CONTAINER_ID,1) != 'X'
AND SHIPPING_CONTAINER.STATUS = 600
AND LEN(SHIPPING_CONTAINER.CONTAINER_ID) < 25
AND SHIPPING_CONTAINER.INTERNAL_SHIPMENT_NUM IN
(SELECT SHIPMENT_HEADER.INTERNAL_SHIPMENT_NUM
FROM SHIPMENT_HEADER
WHERE SHIPMENT_HEADER.SHIPMENT_ID = @SHIPMENT_ID)
Thanks in advance