July 22, 2019 at 8:22 pm
The Tables I use often times have control characters in them, like CRs and LFs. The data also has spaces.
I know how to remove spaces, but how can I a function like CLEAN (in Excel) in my SSMS report??
possible?
thanks
July 22, 2019 at 9:59 pm
PatExclude or PatReplace can do the trick.
For example, this will remove any characters that are not alphanumeric while preserving spaces (note the space after the "Z"):
SELECT f.* FROM dbo.PatExclude8K(<yourstring>, '[^0-9a-zA-Z ]') AS f;
note that this is an Inline table valued function (because they are faster than scalar). So you'll need to understand how to use APPLY.
-- Itzik Ben-Gan 2001
July 22, 2019 at 10:44 pm
Thanks!!
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy