Report showing no data when using stored procedure and temp table
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/6f955c3b-cfc9-4430-b41d-a24e0a3dc836 that post contains the best example for Temp Table. Tables created with '@' are better than those with '#'
November 23rd, 2011 1:33am

I created a stored procedure that returns a temp table dataset. Something like: (@startDate DATETIME,@endDate DATETIME) AS BEGIN CREATE TABLE #mytable . . . INSERT INTO #mytable([Main], [Group],[Value], [Count]) SELECT 'a' as [Main], 'b' as [Group], 'c' as [Value], 'd' as [Count] . . . SELECT * FROM #mytable WHERE [count] IS NOT NULL END GO The reports connects to it and auto generates the values for the dataset. I can run the procedure from the dataset and the result set is displayed. I drag a table and create a group. When I preview the report it asks for the parameters (just like in the dataset but at the report level) I enter the same values but the data does not show. The table pretty much come back blank.
Free Windows Admin Tool Kit Click here and download it now
November 26th, 2011 5:16pm

I would suggest using CTE's instead of temp table. They work well with Reports and are efficient when it comes to performance. it works like this With myTable([Main], [Group],[Value], [Count]) as ( SELECT 'a' as [Main], 'b' as [Group], 'c' as [Value], 'd' as [Count] ) select * from myTable. If there are any calculations, you can use functions to get the values and use them here.
November 26th, 2011 5:50pm

http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/6f955c3b-cfc9-4430-b41d-a24e0a3dc836 that post contains the best example for Temp Table. Tables created with '@' are better than those with '#'
Free Windows Admin Tool Kit Click here and download it now
November 26th, 2011 5:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics