• I haven't tested this enough to be sure, but it should work:

    create function dbo.NumberClean

    (@String_in nvarchar(100))

    returns bigint

    as

    begin

    declare @NumberStr nvarchar(100), @Number_out bigint

    ;with Chars (Seq, Chr) as

    (select number, substring(@string_in, number, 1)

    from dbo.Numbers

    where number between 0 and len(@string_in))

    select @numberstr = coalesce(@numberstr + chr, chr)

    from chars

    where chr like '[0-9]'

    select @number_out = @numberstr

    return @number_out

    end

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon