$ 0 0 man, this is not query, it is a store procedure. You need to show us the detail of that SP. Frank