Problem solve Get help with specific problems with your technologies, process and projects.

Ordering the results of a SQL query

Learn how to order the results of a SQL query when using case statements in a SQL Server Reporting Services (SSRS) report.

I am using a case statement to order data on a SQL Server Reporting Services report. When the statement runs it returns the correct order, but when I save the Report Definition Language (RDL) and preview it, it returns to ascending order. How do I correct this?
It is a little hard to verify this without seeing the code. However, the typical rule of thumb is that if you do not explicitly order the results in a SQL query, then you are at the mercy of the database or API engine that is producing the results. Try explicitly adding an ORDER BY to your statement.
This was last published in September 2008

Dig Deeper on Microsoft SQL Server Reporting Services (SSRS)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.