• Atif Sheikh (4/29/2009)


    if you are willing to ignore records with non-numeric value in MPANCORE,

    try this

    select *

    from thangela.NpowerNorthern_v1 a

    INNER JOIN EPPS.dbo.Customers b ON case when IsNumeric(b.MPANCORE) = 1 then b.MPANCORE else -1 end = a.MPAN1

    -- Asuming -1 will not be the valid value for a.MPAN1

    That might work, but you need to be carfull using SQL's "IS" functions.. DECLARE @Foo VARCHAR(50)

    SET @Foo = '1e1'

    -- Is numeric

    SELECT ISNUMERIC(@Foo)

    -- Conversion fails

    SELECT CAST(@Foo AS NUMERIC(17,2))