SELECT B.NAME, CASE WHEN CONVERT(date, A.SCHEDULEDRETURNDATE) = '1900-01-01' THEN DATEADD(YEAR, 100, STARTDATE) ELSE A.SCHEDULEDRETURNDATE END AS SCHEDULEDRETURNDATE, 
                  A.PALDC_STARTDATETIME AS STARTDATE, C.LOANITEMID, D.LOANTYPEID, A.RECID AS LOANID
FROM     dbo.HCMPERSONLOAN AS A INNER JOIN
                  dbo.DIRPARTYTABLE AS B ON A.PERSON = B.RECID INNER JOIN
                  dbo.HCMLOANITEM AS C ON A.LOAN = C.RECID INNER JOIN
                  dbo.HCMLOANTYPE AS D ON C.LOANTYPE = D.RECID
WHERE  (D.LOANTYPEID = 'PR-AUTO')
