Professional Web Applications Themes

Next SQL2K command runs ok 50-100 times... and then returns no records. - Microsoft SQL / MS SQL Server

I'm running SQK2k on a Windows 2K Server box. My client machine is using W2K Pro and some client-side VBscript (v5.6) with some pretty standard/common calls like "CreateObject("microsoft.xmlhttp"), open, send, responseText and ADO" in order to fetch some data from the server. I have about 4000 records that all have valid MyKey and MyTime fields. I'm given the KEY... and use a nested SELECT call to find its matching TIME field. I then take that TIME... and find all the record with identical times. (Usually 1-5 records are returned.) I then need to find the highest KEY... from that group ...

  1. #1

    Default Next SQL2K command runs ok 50-100 times... and then returns no records.

    I'm running SQK2k on a Windows 2K Server box.

    My client machine is using W2K Pro and some client-side VBscript (v5.6) with
    some pretty standard/common calls like "CreateObject("microsoft.xmlhttp"),
    open, send, responseText and ADO"
    in order to fetch some data from the server.

    I have about 4000 records that all have valid MyKey and MyTime fields.

    I'm given the KEY... and use a nested SELECT call to find its matching TIME
    field.

    I then take that TIME... and find all the record with identical times.
    (Usually 1-5 records are returned.)

    I then need to find the highest KEY... from that group of records.

    The call looks like this:
     
    MyTable WHERE (MyKey=3242))

    I can run it in a loop... about 50-100 times... successfully... and then it
    returns no records.
    Then it runs ok for another 50-100 executions... and then returns no records
    again.

    Wouldn't it *ALWAYS* have to return at least 1 record? (Even it only
    returned the same key given to it.)

    Perhaps a time-out problem? Maybe the inside nested command is taking too
    much time to execute... and not running the
    outside command?

    Any ideas?

    Thanks


    Bill Guest

  2. #2

    Default Re: Next SQL2K command runs ok 50-100 times... and then returns no records.

    > Wouldn't it *ALWAYS* have to return at least 1 record?

    Yes.
     

    Nope.

    -----

    It should always return a row since the query is an aggregrate
    without a GROUP BY or HAVING clause.

    Likely you have failed to distinguish between
    no row and a row with a NULL value in it's column.

    I would guess the real problem is you have failed to account
    for MyTime sometimes being null (and/or there are no rows
    with MyKey that have those particular values).

    -----

    Are you using the loop because of something else?
    If not you could just write a single query that utilizes GROUP BY.

    Bye,
    Delbert Glass

    " Bill" <com> wrote in message
    news:#phx.gbl... 
    with 
    TIME 
    > MyTable WHERE (MyKey=3242))
    >
    > I can run it in a loop... about 50-100 times... successfully... and then[/ref]
    it 
    records 
    too 


    Delbert Guest

  3. #3

    Default Re: Nested SQL2K command runs ok 50-100 times... and then returns no records.

    > > Wouldn't it *ALWAYS* have to return at least 1 record? 
    > Nope.[/ref]

    If other records had the same TIME value... it would return 1 of those.

    If no other records had the same TIME value... it would return MAX(key)...
    which would be the same as KEY.
    No?
     

    100% of the records have valid TIME and KEY values.
    (Some of the other fields might be NULL... but... I'm not dealing with those
    values. Or can those also
    effect a nested query?)
     

    MyTime is always a valid time.
    The MyKey that I 1st search for.... is always guaranteed to exist.
    There may (or may not) be *MORE* records with that exact TIME value.

    1 second after a "failed attempt"... the *EXACT* same query works fine.
     

    I should have mentioned that my quick 50-100 loops... was just to try and
    track this problem down.
    In "real-life", I execute this query every 5-10 minutes or so.

    It's really strange. Seems like a "server load" or "too slow to return
    values" problem.

    I *DO* appreciate your suggestions.

     
    > with [/ref]
    "CreateObject("microsoft.xmlhttp"), 
    > TIME 
    > > MyTable WHERE (MyKey=3242))
    > >
    > > I can run it in a loop... about 50-100 times... successfully... and then[/ref]
    > it 
    > records 
    > too 
    >
    >[/ref]


    Bill Guest

Similar Threads

  1. #25347 [Bgs]: ftp_rawlist() returns nothing, when apache runs as service
    By spam at come dot no-ip dot com in forum PHP Development
    Replies: 6
    Last Post: March 4th, 10:42 PM
  2. Replies: 4
    Last Post: October 9th, 03:30 PM
  3. #25347 [Com]: ftp_rawlist() returns nothing, when apache runs as service
    By manu at agat dot net in forum PHP Development
    Replies: 1
    Last Post: September 2nd, 04:11 PM
  4. #25347 [NEW]: ftp_rawlist() returns nothing, when apache runs as service
    By spam at come dot no-ip dot com in forum PHP Development
    Replies: 0
    Last Post: September 1st, 09:28 PM
  5. Replies: 1
    Last Post: August 7th, 08:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139