Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2009, 10:56 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Question Queries hanging and never complete

I have an asp application that connects to a server (2005) and calls a sp. From time to time the queries do not complete and looking at the activity monitor there are several jobs out there running the same query. The only way to get the application working is to restart the server. Since I do not know too much how things works I hope to get some insight to what is going on.

I read an article saying

"When creating a temporary table do not create them with a transaction. If you create it with a transaction, it will lock some system tables (syscolumns, sysindexes, syscomments). This will prevent others from executing the same query." I am not sure what this means.

Also when calling the stored procedure we always use the same log on, user id and password, not usre if this could create an issue.

Here is the sp and if someone could comment as to why several queries are running at the same time and never complete:

Code:
declare @JobNumber1 char(12)
declare @ItemNumber1 char(8)
declare @JdeDateFrom int
declare @JdeDateTo int 
set @JobNumber1 = '     3505040'
set @ItemNumber1 = '01010    ' 
set @JdeDateFrom = 108217
set @JdeDateTo = 108217
 
If Object_ID('tempdb..#JDE_LaborHrsDetailTable1') Is Not Null    Drop Table #JDE_LaborHrsDetailTable1
 
create table    #JDE_LaborHrsDetailTable1
        (  jde_job_date datetime,
           jde_cost_code char(15),
           jde_equipment_id char(10),
           jde_equipment_name char(20),
           jde_employee_name char(15),
           jde_employee_hours decimal(8,2),
           jde_equipment_hours decimal(8,2) 
                                               )
 
Set NoCount On
 
insert into #JDE_LaborHrsDetailTable1(jde_job_date, jde_cost_code, jde_equipment_id, jde_equipment_name,
                                   jde_employee_name, jde_employee_hours, jde_equipment_hours)
Exec ('Call QGPL.get_labdet(?,?,?,?)', @JobNumber1, @ItemNumber1, @JdeDateFrom, @JdeDateTo) AT AS400SRV_MSDASQL
 
select * from #JDE_LaborHrsDetailTable1 order by jde_job_date
 
drop table #JDE_LaborHrsDetailTable1





Similar Threads
Thread Thread Starter Forum Replies Last Post
Report Viewer is hanging up rachel_caleb13 Crystal Reports 0 July 11th, 2007 05:28 AM
VS2003 hanging gbrown VS.NET 2002/2003 3 October 9th, 2006 01:50 PM
code downloads - hanging... daboooooh Forum and Wrox.com Feedback 1 May 15th, 2006 01:53 PM
Hanging process Gert SQL Server 2000 0 April 4th, 2005 04:08 AM
page hanging Adam H-W Javascript 6 October 28th, 2004 07:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.