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.
Author |
Topic |
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2013-06-16 : 21:12:17
|
Hi All,I got error:Msg 5309, Level 16, State 1, Line 3Windowed functions do not support constants as ORDER BY clause expressions.My code as below:-SELECT Row_Number() Over(ORDER BY CASE WHEN 'UserID' = 'UserID' AND 'asc' = 'asc' THEN UserID END ASC, CASE WHEN 'UserID' = 'UserID' AND 'asc' = 'desc' THEN UserID END DESC ) as Sno, COUNT(*) Over() TOTALROWS, UserID, EMAIL FROM aspnet_Membership Please advise.Thank you.Regards,Micheale |
|
MuMu88
Aged Yak Warrior
549 Posts |
Posted - 2013-06-17 : 00:10:01
|
Try this:[CODE]SELECT Row_Number() Over(ORDER BY CASE WHEN ('UserID' = 'UserID' AND 'asc' = 'asc') THEN UserID WHEN ('UserID' = 'UserID' AND 'asc' = 'desc') THEN -1 * UserID ELSE UserID END ) as Sno, COUNT(*) Over() TOTALROWS, UserID, EMAIL FROM aspnet_Membership [/CODE] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-17 : 01:05:37
|
what do the below conditions means? look like a trivial check to me'UserID' = 'UserID' ,'asc' = 'asc' etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|