Wednesday, September 25, 2013

[SQL Server] sleeping connection limit

[SQL Server] sleeping connection limit


sleeping connection limit

Posted: 25 Sep 2013 09:20 AM PDT

One of my SQL Servers has 15,835 connected session with only 4 active. One application account has 15500+ sleeping connections with last batch date on most of them going back almost a month.My other SQL Servers will see between a few and a few hundred sessions. Is 15,000 excessive? Could it be due to some app pool setting? Does SQL Server have an option to release connections that are idle for a period of time?Thanks!Howard

Creating a CASE login within a CASE logic

Posted: 25 Sep 2013 12:57 AM PDT

I have the following code which seems to accumulate the complete file - rather than the upper record set -When OperationPhase = 2 and ResCat = 'MC' - I want to sum it.SUM( CASE OperationPhase WHEN 2 THEN (CASE ResCat when 'MC' then ResAllocTime else 0 end ) else 0 end ) as TotalSetUpMC,SUM( CASE OperationPhase WHEN 3 THEN (CASE ResCat when 'MC' then ResAllocTime else 0 end ) else 0 end ) as TotalRunMC,SUM( CASE OperationPhase WHEN 2 THEN (CASE ResCat when 'PERS' then ResAllocTime else 0 end ) else 0 end ) as TotalSetUpPERS,SUM( CASE OperationPhase WHEN 3 THEN (CASE ResCat when 'PERS' then ResAllocTime else 0 end ) else 0 end ) as TotalRunPERS,

how to script an conditional update

Posted: 25 Sep 2013 12:05 AM PDT

Hi all clever scripters out there!I am going to make a one time update after having made a new function.I have one table[dbo].[savedduty]( [NAME] [varchar](20) NULL, [STARTTIME] [int] NULL, [DAYS] [int] NULL, [ENDTIME] [int] NULL, [DAEKBEMAND] [tinyint] NULL, [EMPLOYEEGROUPID] [int] NULL, [ID] [int] IDENTITY(1,1) NOT NULL, [Selected_Record] [tinyint] NULL, [Name_Day_2] [char](20) NULL, [InstitutionsId] [int] NULL, [Color] [int] NULL, [Color_R] [tinyint] NULL, [Color_B] [tinyint] NULL, [Color_G] [tinyint] NULL,The important part here is [NAME] and [ID], which is the two components i should use to update this table:[dbo].[dutyrostershift]( [DATO] [datetime] NULL, [STD] [tinyint] NULL, [SPECIALVAGT] [tinyint] NULL, [DAEKBEMAND] [tinyint] NULL, [EXTRATIMER] [real] NULL, [OVERARBTIMER] [real] NULL, [MANUEL] [tinyint] NULL, [BESKYTTET] [tinyint] NULL, [CONFIRMED] [tinyint] NULL, [VACATIONTYPE] [varchar](50) NULL, [BREAKSWISH] [tinyint] NULL, [DUTYROSTERID] [int] NULL, [EMPLOYEEID] [int] NULL, [EMPLOYEEGROUPID] [int] NULL, [CHILDFORCAREDAYID] [int] NULL, [ORIGINATINGSTAFFINGREQUIREMENTID] [int] NULL, [SHIFTTYPE] [int] NULL, [FROMTIME] [int] NULL, [TOTIME] [int] NULL, [ID] [int] IDENTITY(1,1) NOT NULL, [LeaveType_Id] [int] NULL, [LoginID] [int] NULL, [StatusNo] [int] NULL, [Time_Stamp] [datetime] NULL, [Comment] [char](120) NULL, [Is_Free_sat] [tinyint] NULL, [Is_Center_Opening] [tinyint] NULL, [is_fo_day] [tinyint] NULL, [SavedDuty_Id] [int] NULL,The rule is Pretty simple:If dbo.dutyrostershift.vacationtype = dbo.savedduty.name then dbo.dutyrostershift.savedduty_id = dbo.savedduty.id.i.e. if vacationtype exists in name from savedduty, update saveddutyroster_id with ID from saveddutyBut, how to script this?Best regardsEdvard Korsbæk

No comments:

Post a Comment

Search This Blog