all groups > sql server reporting services > july 2005 >
You're in the

sql server reporting services

group:

Sorting Not Working From Stored Procedure


Sorting Not Working From Stored Procedure Chriis
7/27/2005 12:49:04 PM
sql server reporting services: I have a stored procedure that manipulates data from one table and store it
into a temp table. In the Report Designer data tab, if I run the stored
procedure the data is sorted by a sort field I added. However, when I view
the report in Preview, the report is not sorted correctly. I have set the
Re: Sorting Not Working From Stored Procedure Bruce L-C [MVP]
7/27/2005 3:16:37 PM
Try removing the sort field from the report (since you already sorted it in
the SP). No reason to apply the sort a second time. My guess is something is
not specified properly with your sort. I almost never use RS sorting, I sort
in the query or the stored procedure.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Sorting Not Working From Stored Procedure Chriis
7/28/2005 5:15:01 AM
I removed the sort from RS, however the sorting is still wrong.

Let me explain exactly what I am doing. I am pulling Bulletin information
that has a bulletin number associated with it. the numbers are sequential,
however some bulletins have been deleted but need to show on the report as
cancelled. So in my stored procedure i am pulling the data and as I loop
through if the job has been cancelled I add it to the temp table. After I
fill the temptable with all of the data including the cancelled job
placeholders. I return this data sorted by bulletin number.

When I run the SP in Query Analyzer or from the data tab in the Visual
Studio Report Designer the data is sorted on the Buletin Number such as
40000
40001 - cancelled
40002
However in the report it drops the 40001 which was one of the added jobs to
the bottom like
40000
40002
40003
.......
40001 - cancelled

It puts all of the records that where added to the temp table at the bottom.

Any ideas?

[quoted text, click to view]
Re: Sorting Not Working From Stored Procedure Chriis
7/28/2005 8:51:04 AM
I figured it out. I had a hidden group that was not being used, however it
was hosing up the sort. I took it out and it now works. Don't really
understand why it was hosing up the sort, but for whatever reason that fixed
it.

Thanks so much for your help.

[quoted text, click to view]
Re: Sorting Not Working From Stored Procedure Bruce L-C [MVP]
7/28/2005 9:24:52 AM
Yes. What is your statement returning data from the temp table? You should
have an order by in that statement.

select * from #temp order by bullitin_number


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Sorting Not Working From Stored Procedure Bruce L-C [MVP]
7/28/2005 11:20:08 AM
Good. Glad you got it figured out.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button