hmm.. thats odd.
Where did you execute the code i have given you? storedb or hq?
For stores that throws an error in data upload, can you query the following and email me the result.
in storedb,
Select Max(Servertime)
from Timestamplog
in hq,
Select Storeid,Max(Servertime)
from Timestamplog
group by Storeid