We received an MSSQL database with many tables and fields which we need to clean. One of the things we need to do is remove all quotes (chr(34) and chr(39)) from any text fields.
Looking for a way to do this automatically instead of manually.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A non-set based approach:
The below sproc basically does what you need.
It uses nested WHILE loops
can modify). Then it uses dynamic SQL to update with new string.
For many tables and large sized tables, this would obviously take quite a while to complete. I am sure this can be optimized better.
If anyone can find a set-based approach, that would be something.
Source & Courtesy: Vyaskn