Date Order

  • Hi,

    Sorry If I am posting in the wrong forum 🙁

    I have got a report and everything looks okay except it shows wrong order date. it starts from 01,02,03 but I think it should show the result like this

    26,27,28 etc and it shows me 01,02,03,26,27,28. in my sql query I used convert(varchar(20), DateEntered(106) when I change it then it breaks date column looks in the report.

    Can please someone guide me how to fix this issue?

    Thanks,

  • You have many options to change the way dates are displayed in reporting services: just change the formatting options of the date field in the report.

    As far as the sort order is concerned, treating dates as dates is the only way to ensure that the proper order relationship is preserved.

    -- Gianluca Sartori

  • The issue is with date sort order. it sorts it in lower number first then higher date it is a weekly report but when the month change and if I run the report the date now then it would start from 01jun,02jun 27May,28,May,29May.

    Thanks,

  • yusufm 48726 (6/3/2015)


    The issue is with date sort order. it sorts it in lower number first then higher date it is a weekly report but when the month change and if I run the report the date now then it would start from 01jun,02jun 27May,28,May,29May.

    Thanks,

    Do you convert your datetime datatype in sql and pass back the string to the report? The order you are displaying is ordered correctly for characters. This is why you should leave ALL formatting to the front end. If you return the correct datatype from sql and let your report sort it and format it you will be able to solve this easily and quickly.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • You need to sort the data by the actual date, not the date converted to varchar.

    In the report,you can display the converted date.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Thanks Alvin Ramard, I changed the query convert for date.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply