CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Location
    London, England
    Posts
    563

    Query Analyzer....

    Hi all,
    I'm running a simple select * query in the QA. However, in QA it continues to state that the query is running which maybe taking about 2-3 mins!!
    BUT, in the SQL profiler it comes up with batch completed, even though the query is still running in QA!!

    Can anyone shed any light as to whats going on?
    This is an actual Insert Into... Select [Column] that is causing problems within my application in that it times out after the default number of secs.

    Regards

    John
    I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Query Analyzer....

    how long does the select query take to run? are there any triggers on the insert table that may be slowing things down?
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  3. #3
    Join Date
    May 2004
    Location
    London, England
    Posts
    563

    Re: Query Analyzer....

    The Query is as follows :

    Code:
    Insert into TableName
    select T.ID, T.RecordType, T.Status, T.Available
    from (TableName T inner join Selection S on S.selectionID = T.ID)
                                  inner join Assessement A on S.EventID= A.ID
    where A.highlighted = @InputParameter
    The above query works as expected as it returns the number of rows as expected for a given @InputParameter

    However, the following SQL is where the problem lies:

    Code:
    select count(*) Select_Count from TableName
    where RecordType = 'T' and Status='C' and Available = 0
    All the above SQL is wrapped up into a stored procedure and is called within my application.
    But the last SQL select statement above times out after 30 seconds in my app, but in the Query analyzer it continues to be executed for as long as 10 minutes. There is no reason as to why it keeps on executing or timing out as the rows returned maybe 0 or 1000 (max) at any given time.

    In the Profiler, *sometimes* it will state that the last SQL has completed, but in the Query Analyzer it will be shown that its still executing.

    I think it may prove tto be helpful that these two SQL procedures are run when there is alot of traffick on the database server network.
    Any explanations?
    Last edited by Vaderman; July 14th, 2006 at 06:31 AM. Reason: additional relevant information
    I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)

  4. #4
    Join Date
    May 2004
    Location
    London, England
    Posts
    563

    Re: Query Analyzer....

    OK.. let me ask this question. In the profiler, I am tracking a Stored Procedure and it has Audit Login when it starts the SP and Audit Logout when it completes the SP.

    Does this mean that my application has logged in and out of the database?

    If this is the case, why has it not done this with my previous Stored Procedures?
    I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured