Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 4 of 4 total |
Index problem |
Wed, Jul 20 2011 10:13 AM | Permanent Link |
Stagiaire12 | Hello,
I have 2 sort orders in my table, ASC and DESC: NULL 9 NULL 8 6 7 7 6 8 NULL 9 NULL Is it possible to get the NULL value always on top in the table? In the index settings I see no option for it. Thanks |
Wed, Jul 20 2011 10:26 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Stagiaire12
I think the answer is no but if you're using SQL rather than tables you can cheat and use COALESE ORDER BY COALESCE(sortcol,9999999) DESC will put NULLs at the top as will ORDER BY COALESCE(sortcol, -99999) ASC Roy Lambert [Team Elevate] |
Fri, Jul 22 2011 4:47 PM | Permanent Link |
Chris B | Stagiaire12 wrote:
Hello, I have 2 sort orders in my table, ASC and DESC: NULL 9 NULL 8 6 7 7 6 8 NULL 9 NULL >>Is it possible to get the NULL value always on top in the table? In the index settings I see no option for it. Alternatively, order by ORDER BY CASE WHEN ISNULL(FieldName) THEN 0 ELSE 1 END, ColumnName |
Mon, Jul 25 2011 2:19 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << Is it possible to get the NULL value always on top in the table? In the index settings I see no option for it. >> You can do so, but you have to do it in a "roundabout" way. What you do is create a generated or computed column that includes an expression similar to what Roy and Chris have proposed, and then create an index on this column instead. That will give you an index with a custom sort for the NULL values. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 5, 2024 at 07:30 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |