Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 24th, 2009, 10:56 AM
Friend of Wrox
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
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:

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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:32 AM.

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