Wednesday, 10 May 2017

Update or Remove all special charactor

UPDATE VehicleTripEntry
SET Vehicleno =
(
CASE WHEN Vehicleno LIKE '%[^a-zA-Z0-9]%' THEN Replace(REPLACE( Vehicleno, SUBSTRING( Vehicleno, PATINDEX('%[~,@,#,$,%,&,*,^,&,%,*,(,), ,`]%', Vehicleno), 1 ),''),'-','')
ELSE Vehicleno
END                    
)
where VehicleType = 'H'

No comments:

Post a Comment