Assume that there is a set of monic polynomials P-n(z) satisfying the second-order difference equation A(s)P-n,(z(s + 1)) + B(s)P-n(z(s)) + C(s)P-n(z(s - 1)) = lambda P-n(n)(z(s)), n = 0, 1, 2,..., N, where z(s), A (s), B(s), C(s) are some functions of the discrete argument s and N may be either finite or infinite. The irreducibility condition A(s - 1)C(s) not equal 0 is assumed for all admissible values of s. In the finite case we assume that there are N + 1 distinct grid points z(s), s=0, 1,..., N such that z(i) not equal z(j), i not equal j. If N = infinity we assume that the grid z(s) has infinitely many different values for different values of s. In both finite and infinite cases we assume also that the problem is non-degenerate, i.e., lambda(n) not equal lambda m, n not equal m. Then we show that necessarily: (i) the grid z(s) is at most quadratic or q-quadratic in s; (ii) corresponding polynomials p(n)(z) are at most the Askey-Wilson polynomials corresponding to the grid z(s). This result can be considered as generalizing of the Bochner theorem (characterizing the ordinary classical polynomials) to generic case of arbitrary difference operator on arbitrary grids. (C) 2006 Elsevier B.V. All rights reserved.