Try this formula:
=INDEX(Sheet2!A:A,MATCH(LEFT(B1,3),Sheet2!B:B,0))
Put this in Sheet1 cell T1 and fill downward. This will return the value in column A of sheet2 where column B of sheet2 matches the first 3 characters of column B in sheet1.

I assumed your 'database' on sheet2 only contains 3 characters, while column B on sheet1 contains the full ID.