We help IT Professionals succeed at work.
Get Started

Temp Table Bug in Crystal Enterprise and Add Command?

DataDesignIT
DataDesignIT asked
on
341 Views
Last Modified: 2008-02-26
Experts-

I have a Command in my report where I'm using temporary tables. I can handle it locally with the SQL Server syntax below. However, when I try this successfully-imported report when using Crystal Enterprise, it's failing (apparently in the query; although I can't see what the error is).

What am I doing wrong? When testing locally, I found that sometimes Crystal would fail because the temp tables were identified as being present (when really they're not). Trying various combinations of keeping the DROP TABLE statements in, moving them to the conclusion, keeping them in both places has hit-and-miss effects. It's as if Crystal is parsing my SQL statement and evaluating, then running, or?... So, although I figured out the 'secret-combination' locally, now it's dying on Enterprise. (Grrrr....)

I'd like to keep this all in the Add Command 'realm' if possible. Any recommendations?
Thanks

--------- START ---------------
drop table #tmp_expense;
drop table #tmp_footage;
drop table #tmp_master;
drop table #tmp_detail;

select * into #tmp_expense
from (blah-blah) as expenses

select * into #tmp_footage
from (blah-blah) as footage

select * into #tmp_master
from (blah-blah) as masterstuff

select *into #tmp_detail
from (blah-blah) as thedetails

[[[ ....... Here's the actual query that uses the TEMP tables ....... ]]]
select distinct master_plant, master_expense, detail_surface_feet, master_month_name, master_month_num,
sum(detail_exp_amount) as expense_amount
from #tmp_master left outer join #tmp_detail on detail_month_num = master_month_num and master_plant = detail_plant
group by master_plant, master_expense, detail_surface_feet, master_month_name, master_month_num
order by master_month_num, master_expense, master_plant

--------- END ---------------

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE