Scripts to remove special characters from IN_Part records

Description of Issue: 
If Part codes, Descriptions, or other text fields contain special characters in the field, it can cause problems in the application. 

These are not allowed, and the application will prevent the record from being saved.  

A screenshot of a computer code 
Description automatically generated

Resolution: 
The scripts below can be used to remove these special characters from the fields in IN_Part.  

--- Backup Table before making changes. ---  

select * INTO IN_PART_backup12345 from IN_Part  

--- Remove invalid  
UPDATE IN_Part 
SET 
Part_Code = REPLACE(Part_Code, '_', ' '), 
Description = REPLACE(description, '_', ' '), 
Detail = REPLACE(Detail, '_', ' '), 
Purchase_Description = REPLACE(Purchase_Description, '_', ' '), 
Service_Description = REPLACE(Service_Description, '_', ' '), 
Sales_Description = REPLACE(Sales_Description, '_', ' ') 
where [description] like '%_%' OR detail like '%_%'     


UPDATE IN_Part 
SET 
Description = REPLACE(description, '|', '/'), 
Detail = REPLACE(Detail, '|', '/'), 
Purchase_Description = REPLACE(Purchase_Description, '|', '/'), 
Service_Description = REPLACE(Service_Description, '|', '/'), 
Sales_Description = REPLACE(Sales_Description, '|', '/') 
where description like '%|%' OR detail like '%|%'    


UPDATE IN_Part 
SET 
Description = REPLACE(description, '®', ''), 
Detail = REPLACE(Detail, '®', ''), 
Purchase_Description = REPLACE(Purchase_Description, '®', ''), 
Service_Description = REPLACE(Service_Description, '®', ''), 
Sales_Description = REPLACE(Sales_Description, '®', '') 
where [description] like '%®%' OR detail like '%®%'    


UPDATE IN_Receipt_Parts 
SET 
Description = REPLACE(description, '®', ''), 
vendor_part_code = REPLACE(vendor_part_code, '®', ''), 
vendor_part_description = REPLACE(vendor_part_description, '®', '') 
where description like '%®%' or vendor_part_code like '%®%' or vendor_part_description like '%®%'   


UPDATE IN_Receipt_Parts 
SET 
Description = REPLACE(description, '|', ''), 
vendor_part_code = REPLACE(vendor_part_code, '|', ''), 
vendor_part_description = REPLACE(vendor_part_description, '|', '') 
where description like '%|%' or vendor_part_code like '%|%' or vendor_part_description like '%|%'  


UPDATE AP_Purchase_Order_Parts 
SET 
Memo = REPLACE(Memo, '®', ''), 
vendor_part_code = REPLACE(vendor_part_code, '®', ''), 
vendor_part_description = REPLACE(vendor_part_description, '®', '') 
where memo like '%®%' or vendor_part_code like '%®%' or vendor_part_description like '%®%'   


UPDATE AP_Purchase_Order_Parts 
SET 
Memo = REPLACE(Memo, '|', ''), 
vendor_part_code = REPLACE(vendor_part_code, '|', ''), 
vendor_part_description = REPLACE(vendor_part_description, '|', '') 
where memo like '%|%' or vendor_part_code like '%|%' or vendor_part_description like '%| 
Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.