Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic Ordering

Author  Topic 

Cyclonik
Posting Yak Master

114 Posts

Posted - 2001-03-20 : 18:18:03
How would i go about implementing a Dynamic Order By clause in an Stored Proc

with this i get the error following it..
Select a.*, b.lname as SLname ,b.fname as SFname from tblUsersT a LEFT JOIN tblUsersT b ON b.lanid = a.ManagerID where a.managerid = @lanid Order by @OrderBy

Error:
Error: The select list item identified by the order by number '1' contains a variable as part of the expression that identifies a column position. Variables are only allowed when ordering by an expression referencing a column name. (State:37000, Native Code: 3F0)

Maybe i just don't understand the error..

Thanks
Christian


-=:SpasmatiK:=-
   

- Advertisement -