Re: Is there anything like DoEvents in a stored proc?

From: Randy Danielson (no_freakin_spam_at_sickofit.com)
Date: 05/10/04


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
>
>



Relevant Pages

  • Re: Trying to use STRING
    ... having done a job your client considers worth paying for. ... any reason and bans their use. ... Next minute you are in an annual review ... we allowed them fancy ANSI '74 constructs in a couple a' years back... ...
    (comp.lang.cobol)
  • Re: Contributing to u.r.c. Jelly babies in short supply
    ... | Any reason why you saw little worth? ... | It could be that the questions were of "little worth" but I have to ... Or perhaps your happy to reinforce the prejudices ... I don't think the cause of 'truth' that you refer to is served by online ...
    (uk.religion.christian)
  • Re: The Cheap and Clever RV Contest
    ... enough that I could see any reason to pay $5k more than it was worth. ... With small motorhomes all I worry about is height ... otherwise the thing will park just about anywhere a big car ...
    (rec.outdoors.rv-travel)
  • Re: Paying via credit card through Paypal
    ... other than when a card is replaced I have to update it. ... So this is more work to you than it's worth? ... imagine paying for anything by a Cashiers check, ... I suppose that could be the reason? ...
    (alt.marketing.online.ebay)
  • Re: right margin info
    ... could only solve it by toggling complex HTML - until, ... reason, I arhived and restored my system. ... this is a big deal worth fixing. ... When the right margin problem ...
    (microsoft.public.mac.office.entourage)