/*************************************** * FUNCTION f_onlyNumbers * * elimina tutti i caratteri alfabetici dalal stringa * * Steamware, S.E.L. * mod: 2010.03.19 * ****************************************/ CREATE FUNCTION [dbo].[f_onlyNumbers] (@string NVARCHAR(255)) RETURNS NVARCHAR(255) AS BEGIN DECLARE @answ NVARCHAR(255) -- sostituisco TUTTE le lettere dell'alfabeto SET @answ = (SELECT REPLACE(@string, 'a', '')) SET @answ = (SELECT REPLACE(@answ, 'b', '')) SET @answ = (SELECT REPLACE(@answ, 'c', '')) SET @answ = (SELECT REPLACE(@answ, 'd', '')) SET @answ = (SELECT REPLACE(@answ, 'e', '')) SET @answ = (SELECT REPLACE(@answ, 'f', '')) SET @answ = (SELECT REPLACE(@answ, 'g', '')) SET @answ = (SELECT REPLACE(@answ, 'h', '')) SET @answ = (SELECT REPLACE(@answ, 'i', '')) SET @answ = (SELECT REPLACE(@answ, 'j', '')) SET @answ = (SELECT REPLACE(@answ, 'k', '')) SET @answ = (SELECT REPLACE(@answ, 'l', '')) SET @answ = (SELECT REPLACE(@answ, 'm', '')) SET @answ = (SELECT REPLACE(@answ, 'n', '')) SET @answ = (SELECT REPLACE(@answ, 'o', '')) SET @answ = (SELECT REPLACE(@answ, 'p', '')) SET @answ = (SELECT REPLACE(@answ, 'q', '')) SET @answ = (SELECT REPLACE(@answ, 'r', '')) SET @answ = (SELECT REPLACE(@answ, 's', '')) SET @answ = (SELECT REPLACE(@answ, 't', '')) SET @answ = (SELECT REPLACE(@answ, 'u', '')) SET @answ = (SELECT REPLACE(@answ, 'v', '')) SET @answ = (SELECT REPLACE(@answ, 'w', '')) SET @answ = (SELECT REPLACE(@answ, 'x', '')) SET @answ = (SELECT REPLACE(@answ, 'y', '')) SET @answ = (SELECT REPLACE(@answ, 'z', '')) RETURN @answ END