Re: Is there anything like DoEvents in a stored proc?
From: Randy Danielson (no_freakin_spam_at_sickofit.com)
Date: 05/10/04
- Next message: Randy Danielson: "Re: Stored procedure never finishes"
- Previous message: Egbert Nierop \(MVP for IIS\): "Re: "Invalid Cursor Error""
- In reply to: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Next in thread: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Reply: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 May 2004 13:08:27 -0700
Thanks for the reply.
The reason I can't just select the records I need in the first place is
because I have to make sure that I have complete months worth of data.
So my logic is something like this.
1) Select top 104000 records into temp table
2) Select count if I have exactly 104000 records then I know that most
likely I have a partial months worth of data so now select the oldest
date, do some date math so that I have the date of the first day of the
next month then delete all records that are older than that.
It is actually even more complicated than that because I am building up
very specific data that could not be retrieved in a single query.
I know that it is not efficient, but this runs at night and so it is
more important to have the data accurate and the stored proc easy to
debug.
Thanks
Randy
In article <epadnUGk2aiLNwPdRVn-uQ@giganews.com>,
REMOVE_BEFORE_REPLYING_dportas@acm.org says...
> > 1) create table if doesn't exist else delete all rows
> > 2) select into this table
> > 3) create another table if doesn't exist else delet all rows
> > 4) select large number of records into this table
> > 5) count records
> > 6) delete records if more than a certain number of records
>
> I would question whether it makes sense to move data around in this
> inefficient sequential manner. Can you create a view rather than copying
> rows into another table? Inserting rows then counting and deleting them
> seems especially pointless. Why can't you write your query (4) to insert
> only the rows you require to start with?
>
> If you need more help, please post DDL, sample data and show your required
> result.
> http://www.aspfaq.com/5006
>
>
- Next message: Randy Danielson: "Re: Stored procedure never finishes"
- Previous message: Egbert Nierop \(MVP for IIS\): "Re: "Invalid Cursor Error""
- In reply to: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Next in thread: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Reply: David Portas: "Re: Is there anything like DoEvents in a stored proc?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|