February 2, 2016 at 10:47 am
HI,
Does anyone have a way to search all the columns in a table for special characters (non allowed)?
February 2, 2016 at 10:53 am
Something like this?
DECLARE @SpecialChar char(3) = '%#%' --Example of special character
SELECT *
FROM myTable
WHERE Stringcol1 LIKE @SpecialChar
OR Stringcol2 LIKE @SpecialChar
OR Stringcol3 LIKE @SpecialChar;
Don't use this in production code. This should be a one time cleansing issue and you should prevent the special characters to get in the tables (that's why we have constraints).
February 2, 2016 at 9:44 pm
Check out the following article maybe this will help you out: http://social.technet.microsoft.com/wiki/contents/articles/24169.sql-server-searching-all-columns-in-a-table-for-a-string.aspx
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply