• ( problem in your query

    select

    LEFT(127.0.0.1,len(127.0.0.1)-charindex('.',reverse(([Ip]))))

    from tablename