In FN_REMOVE_SPECIAL_CHARACTER] we make use of WITH clause CTE to store the resultset of all special character in one row table.To remove unwanted special characters,we pass string input values and apply string's replace funtion having special character match values from CTE table .
CREATE FUNCTION [FN_REMOVE_SPECIAL_CHARACTER] (
DECLARE @NEWSTRING VARCHAR(100)
SET @NEWSTRING = @INPUT_STRING ;
With SPECIAL_CHARACTER as
SELECT '>' as item
SELECT '<' as item
SELECT '(' as item
SELECT ')' as item
SELECT '!' as item
SELECT '?' as item
SELECT '@' as item
SELECT '*' as item
SELECT '%' as item
SELECT '$' as item
SELECT @NEWSTRING = Replace(@NEWSTRING, ITEM, '') FROM SPECIAL_CHARACTER
select dbo.[FN_REMOVE_SPECIAL_CHARACTER] ('@s()antosh')
He is presently working as tech arch in one of the leading IT company.He has total 10 years of experience in C#.net. He is a B.E graduate in Computers from Bombay University.
Most of his experiences are in designing architect for end to end solutions. His interest areas are WCF,Spring.net,Architecture- Model View Presenter,UML,Webservice,Performance Engineering/tuning,Design patterns,Generics,Enterprise Library,Regular expressions,Silverlight and WWF.