Under SQL 2000, the Create Procedure for Articles_GetArticles fails
Last Post 9/04/2010 01:31 PM by David O'Leary. 0 Replies.
Author Messages
David O'Leary
Efficion Consulting Staff
Basic Member
Basic Member
Posts:151
Avatar

--
9/04/2010 01: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



    ---