Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2007
    Posts
    4

    Unanswered: script runs fine second time (was "Need Help....")

    Hi Guys and Gals...

    I have a script that runs every night to pull some data from Delphi. For some strange reason the past month it has been failing on the inital running of the script but when I close off all of the error boxes and hit the script again it runs just fine.... Please find enclosed the script . Can anyone tell me whe it is wrong... thanks in advance
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What is the very first error message that you get?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Apr 2007
    Posts
    4

    First error message

    it is a follows:

    Line:67
    Char:1
    Error: ODBC SQL Server Driver Timeout error
    Code:80004005
    Source: OLE DB provider for IDBC Drivers

    The second and continuing errors are:

    Line:49
    Char:1
    Permission Denied
    error:800a0046
    VB Script runtime error


    This program runs at midnight. All the errors appear but yet when I close all of them and hit the script again it runs......

    Any help

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Is there any other activity going on with the database server at midnight?
    Nightly maintenance, for instance?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Apr 2007
    Posts
    4

    Error

    No other items are running that database around or after midnight.. This is a strange as hell...

    Runs fine during the day but when it changes to another day errors......

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What if you set it to run at 12:05 am, so that its execution does not span midnight?
    Honestly, I haven't looked at the details of your dynamic SQL. You should really consider creating this as a stored procedure and dropping the cursor. That would probably effectively solve the problem on its own.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I would expect that this is being caused by SQL needing to read in all the data you are after from disk. Once the first query times out, the second query gets the advantage of having all the data pre-populated in memory. Simple fix, just up your command timeout value. Still, you should look into the query(s) to see if improvements can be made. Especially if the query is taking over 30 seconds as it is.

  8. #8
    Join Date
    Apr 2007
    Posts
    4

    need help...

    My programmer just left yesterday for holidays...

    Can anyone give me the lines needed to add the "command timeout " into my script..... And where it would be best to place it...

    Total anal when it comes to VB... Great with DOS though....


    many thanks

Posting Permissions

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