• This could cause you some serious problems. Until you become able to change anything, here are two possible solutions, but try to convince someone to authorize the change.

    SELECT *

    FROM Table1 t1

    JOIN Table2 t2 ON LEFT( t1.Name, 1) + CAST( t1.Id AS varchar(10)) = t2.Code

    SELECT *

    FROM Table1 t1

    JOIN Table2 t2 ON t1.Id = CAST( REPLACE( t2.Code, 'p', '') AS Int)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2