I am passing sortExp to the followin SP but it does not give me sorted output but if i hardcode the columnname it works fine.Why is the reason? Is my approach right? here is my SP
declare @sortExp nvarchar(100) set @sortExp = 'FirstName'
select * from (select ROW_NUMBER() over (order by @sortExp ) as RowNumber,* from Users) myQueryAlias where RowNumber between 1 and 5