Declare @Value as Varchar(max)
SELECT @Value = COALESCE(@Value + ',', '') + Convert(varchar,ID) FROM Temp1 ORDER BY ID
Select @Value