How could that possibly make sense?
It can't,that was kind of the point. In the old testament,God is often surprised by man. In fact,a few times he has to come down to check things out for himself(casts doubt on the whole "all-knowingness" doesn't it?) before making a decision. However,we are also told that God is indeed all-knowing and all powerful. This one one of the first things to jump out at me that began my doubting of the Bible as the word of God.