For Loop In Select Query In Sql Server