Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Want NULL value of date type column at last when ordering data in report


Want NULL value of date type column at last when ordering data in report

Author
Message
virenkumar.patel
virenkumar.patel
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 91
Hi,
I am using SSRS 2008 R2. Dataset has date field "MyDate". "MyDate" field contains NULL(nothing) values. I am doing sorting on different fields. I am able to sort data with "MyDate" fields also.
Issue : I want Null(Nothing) data at end of list for "MyDate" field sorting. How it will possible. Order
Please provide me solution if anyone have.
PhilPacha
PhilPacha
Old Hand
Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)

Group: General Forum Members
Points: 391 Visits: 2514
Off the top of my head...

In the ORDER BY clause, immediately before the 'MyDate' column, add this CASE statement:

CASE WHEN MyDate IS NOT NULL THEN 1 ELSE 2 END

That will cause the non-null entries to be returned first, followed by the null entries.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search