Module Discussions

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 9/4/2010 1:31 PM by  David O'Leary
Under SQL 2000, the Create Procedure for Articles_GetArticles fails
 0 Replies
Please login to post a reply.
Author Messages
David O'Leary
Efficion Consulting Staff
Basic Member
Basic Member

9/4/2010 1:31 PM
    SQL 2000 does not support Variables within the OrderBy statement. We use NewID() for the Random Sort option but this will fail if your running SQL 2000 or a newer version in SQL 2000 compatibility mode.

    The error message you'll see is:
    The SELECT item identified by the ORDER BY number 6 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.  

    To resolve this problem, use SQL 2005 or newer, or remove this line from the Articles_GetArticles Stored Procedure: CASE @SortField WHEN 'Random' THEN NewID() END

    Please login to post a reply.