Here is how you can get remove special characters from a string in SQL
-- SELECT dbo.[RemoveCharSpecialSymbolValue] ('naga3fg@#sai') CREATE FUNCTION [dbo].[RemoveCharSpecialSymbolValue](@str VARCHAR(500)) RETURNS VARCHAR(500) BEGIN DECLARE @startingIndex int SET @startingIndex=0 WHILE 1=1 BEGIN SET @startingIndex= patindex('%[^0-9a-zA-Z]%',@str) IF @startingIndex <> 0 BEGIN SET @str = replace(@str,substring(@str,@startingIndex,1),'') END ELSE BREAK; END RETURN @str END
Hope this helps 😀
No comments:
Post a Comment