Quesy: replace with null

  • TableA ( empid , empname )

    TableB ( empid, Emprole,EmpSal)

    I wan to look up TableA with TAble B, if TableB does not contain empid with reference to TableA, I want to replace it with null.

    How can i get this done with sql query.

    I want ot use it in SSIS package with LookUp DAta Flow Transformation task.

  • Mike Levan (5/20/2008)


    TableA ( empid , empname )

    TableB ( empid, Emprole,EmpSal)

    I wan to look up TableA with TAble B, if TableB does not contain empid with reference to TableA, I want to replace it with null.

    How can i get this done with sql query.

    I want ot use it in SSIS package with LookUp DAta Flow Transformation task.

    Maybe this?

    SELECT a.empid

    ,a.empname

    ,b.Emprose

    ,b.EmpSal

    FROM TableA a

    LEFT JOIN TableB b ON b.empid = a.empid;

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply