473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Stored Procedure Temp Table Madness

This all centers around an Access Data Project

I have a stored procedure that aggregates events stored in a table
based on intervals I specify. I have a form that supplies parameters
for the stored procedure. My procedure creates a temp table to
populate with the results. The problem I have is that I cannot create
a form or report that uses the stored procedure as a source because
the temp table is dropped when the stored procedure is finished.

Now I understand from reading in these newsgroups and around the
internet that this is not an uncommon problem and I can overcome the
problem by building a real table and populating the data and
subsequently tearing it down but that just doesn't seem like it would
be the ideal solution.

Here is my procedure. Let me know if you have any ideas.

ALTER Procedure Aggregate_Events
@StartTime DateTime,
@EndTime DateTime,
@Aggregation Int
AS

SET NOCOUNT ON

Declare @Interval DateTime

Select @Interval = @StartTime
Create Table #Intervals (Interval DateTime Not Null, Logoffs Int)

While DateDiff(Minute,@Interval, @EndTime) > 0
Begin
Insert Into #Intervals
Select @Interval, Count(Event_DateTime)
From Events
Where DateDiff(Minute,@Interval,Event_DateTime)
Between 0 And @Aggregation - 1
Set @Interval = DateAdd(Minute,@Aggregation,@Interval)
End
Nov 13 '05 #1
1 1743
"BigD" <db**********@yahoo.com> wrote in message
news:68**************************@posting.google.c om...
This all centers around an Access Data Project

I have a stored procedure that aggregates events stored in a table
based on intervals I specify. I have a form that supplies parameters
for the stored procedure. My procedure creates a temp table to
populate with the results. The problem I have is that I cannot create
a form or report that uses the stored procedure as a source because
the temp table is dropped when the stored procedure is finished.


As long as you're using the procedure itself as the recordsource and not the
table iteslf this should work.
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: C Kirby | last post by:
In SQL Server 2000, I've got a rather lengthy stored procedure, which creates a lot of temporary tables as it processes down through a few sets of data. When testing it through Query Analyzer, it...
1
by: Alvin | last post by:
Hi All I need opinions on how to approach my task. I currently have 3 tables: the master table, the archive and a temp table. MASTER: has 3 fields ProductID and ProductNo and Released ARCHIVE:...
18
by: Jarrod Morrison | last post by:
Hi All I was wondering if there is a way to call a stored procedure from inside another stored procedure. So for example my first procedure will call a second stored procedure which when...
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
1
by: Lauren Quantrell | last post by:
I have read the newsgroups and see this is a common issue but I saw no resolution for it: I have an Access2K frotn end and SQL Server 2K backend. In access, I create a temp table using code in a...
1
by: RSH | last post by:
Im trying to create a stored procedure of the following code. I want to set it so that I have to send the first 4 variables (@DB, @BackUpFile,@TestDB,@RestoreFile). I am having trouble when i try...
1
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
9
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.