Abaixo colocarei uma função que você possa extrair apenas números de uma string:
CREATE FUNCTION Fn_extrairnumero(@String VARCHAR(2000)) RETURNS VARCHAR(1000) AS BEGIN DECLARE @Count INT DECLARE @IntNumeros VARCHAR(1000) SET @Count = 0 SET @IntNumeros = '' WHILE @Count <= Len(@String) BEGIN IF Substring(@String, @Count, 1) >= '0' AND Substring(@String, @Count, 1) <= '9' BEGIN SET @IntNumeros = @IntNumeros + Substring(@String, @Count, 1) END SET @Count = @Count + 1 END RETURN @IntNumeros END go
Após criar a função você pode testar usando o seguinte código.
SELECT dbo.Fn_extrairnumero('Meu Endereço é Av. Paulista Nº 7, CEP 00.777-13') GO
Provavelmente aparecerá o seguinte resultado:
70077713
If you are a fan of online gambling, then you must have come across gry…
On the internet online casinos have transformed the betting industry, enabling players to vegas.hu online…
Casinos online offer free spins to draw new customers. These bonuses are usually very profitable,…
In recent times, online casino sites have actually obtained enormous appeal among gamers, providing a…
Bitcoin, the most preferred cryptocurrency worldwide, has reinvented lots of industries, including the on baixar…
Online slots have turned into one of one of the most preferred forms of home…