How can I extract and show only the characters from a string on a column I am searching in SQL Server if the position of the characters varies on the string
Example input:
Mich%ael#
#Scott
Ran%dy
A#nder%son
Output:
%#
#
%
#%
I only able to think of a query like
select
columnname
from
dbo.tablename with (noLock)
where
columnname like '%[%#]%'
but this would not strip and show only the characters I want. I looked at substring()
function but this requires knowing the position of the character to be stripped.