OK, I must be going blind, or something, but I can't see the problem here. I'm running SQL 7 on NT 4 Server. I have a 90 line stored procedure that incrementally builds the FROM and WHERE clauses. The text of the whole sproc is visible here: [url]http://www4.cityofseattle.net/TempMac/EventSearch.sql[/url]The output (using Mode=Week) is this:SELECT *, SortOrder = (' '+ convert(varchar(8), StartDate, 112) + ' ' + convert(varchar(8), EndDate, 112) + ' ' + Title) FROM Events WHERE Events.StartDate <= 'Aug 8 2001 12:00AM' and Events.EndDate >= 'Aug 1 2001 12:00AM' and (DateDiff(day, StartDate, EndDate) + 1) <= 7 ORDER BY SortOrder (it's built as all one string without line breaks)And my error is this: Server: Msg 107, Level 16, State 3, Line 1The column prefix 'Events' does not match with a table name or alias name used in the query.Server: Msg 107, Level 16, State 1, Line 1The column prefix 'Events' does not match with a table name or alias name used in the query.
What am I missing? Is the Select * messing up the rest? SortOrder is a constructed field (from a different thread) and does not conflict with a field in the base table(s).Thanks!------------------------------------------------------------------Contractor$ never die, they just leave for higher-paying project$.Edited by - AjarnMark on 08/01/2001 20:31:11