I didn't quite follow what you are trying to do, but may be this?-- this gives you day of the year
SELECT DATEPART(dy,GETDATE());
-- this gives you day of the year as a character string with zero padding
SELECT RIGHT('000'+CAST(DATEPART(dy,GETDATE()) AS VARCHAR(3)),3)