Answers for "sql remove symbols from string"

SQL
5

sql remove characters from string right

SELECT TRIM('   Exemple   ');						-- 'Exemple'
SELECT LTRIM('   Exemple   ');						-- 'Exemple   '
SELECT RTRIM('   Exemple   ');						-- '   Exemple'
SELECT TRIM(BOTH 'x' FROM 'xxxExemplexxx');			-- 'Exemple'
SELECT TRIM(LEADING 'x' FROM 'xxxExemplexxx');		-- 'Exemplexxx'
SELECT LTRIM('xxxExemplexxx', 'x');					-- 'Exemplexxx'
SELECT TRIM(TRAILING 'x' FROM 'xxxExemplexxx'); 	-- 'xxxExemple'
SELECT RTRIM('xxxExemple', 'x');					-- 'Exemplexxx'
Posted by: Guest on May-12-2021
1

function to remove special characters in sql

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-9.]%',@str)  
if @startingIndex <> 0  
begin  
set @str = replace(@str,substring(@str,@startingIndex,1),'')  
end  
else break;  
end  
return @str  
end
Posted by: Guest on October-02-2020

Code answers related to "sql remove symbols from string"

Code answers related to "SQL"

Browse Popular Code Answers by Language