10 minutes stored procedure now runs hours and hours

  • We have a couple hundred SQL Servers (2000) to upgrade to Service Pack 4. I've done nearly half of them, without trouble, but one server that I upgraded possibly caused a stored procedure that usually takes 10 minutes to now take hours and hours. It ran for 15 hrs and still didn't finish.

    The stored procedure in question goes through a large database and pulls off information into an Access database that then creates a regular datafile.

    We tried re-indexing all the indexes on all the tables using DBCC DBREINDEX. We tried re-creating the stored procedures.

    Before we back out of the SP4 upgrade and return the databases to the old 818 version, is there anything else we should try?

    Is there any way that we can simply set the query of the stored procedure to use SP3 (818) as it did before the upgrade?

     

    Thanks for your help!

     

    Jim Ruddy

    Here is the stored procedure:

    /****** Object:  Stored Procedure dbo.sp_HarteHanksDLSQL    Script Date: 10/27/2006 5:08:31 PM ******/

    /****** Object:  Stored Procedure dbo.sp_HarteHanksDLSQL    Script Date: 9/29/2006 4:47:31 PM ******/

    /****************************************************************************************************************************************************

    *  Stored Procedure: sp_HarteHanksDLSQL

    *  Description:  This SP produces a file that is converted into a text file and uploaded to Harte Hanks.

    *****************************************************************************************************************************************************/

    CREATE PROCEDURE dbo.sp_HarteHanksDLSQL AS

    SELECT

    AFS_Referential_DB.dbo.fn_FileDateText([obln].[ver]) AS FileDate,

    Cast([obln].[OBG_NO] As Varchar(8)) AS Obligor,

    Cast([obln].[OBL_NO] As Varchar(10)) AS Obligation,

    Cast([obln].[obg_no] As Varchar(8)) + Cast('-' As Varchar(1)) + Cast([obln].[obl_no] As Varchar(10)) AS UnqID,

    RTrim(AFS_Referential_DB.dbo.fn_CustName([NAME])) AS ObligorName,

    RTrim(OBLG.ADDR_1) AS Addr1,

    RTrim(OBLG.ADDR_2) AS Addr2,

    RTrim(OBLG.ADDR_3) AS Addr3,

    RTrim(OBLG.CITY) AS City,

    OBLG.ST AS St,

    Left([ZIP],5) AS Zip5,

    RTrim(Substring([zip],6,4)) AS Zip4,

    AFS_Referential_DB.dbo.fn_TaxID([ssn],[TAX_IDENT]) AS TaxID,

    RTrim(OBLG.TELE_1) AS Tel1,

    RTrim(OBLG.TELE_2) AS Tel2,

    RTrim(APPL.SIC_CD) AS SICCd,

    Cast([obln].[SRV] As Varchar(5)) AS ServiceUnit,

    AFS_Referential_DB.dbo.fn_ServUnitName([obln].[srv]) AS ServiceUnitName,

    Cast([obln].

    As Varchar(5)) AS Division,

    RTrim(tblDIVISION.Description) AS DivisionName,

    Cast([obln].[REG] As Varchar(5)) AS Region,

    RTrim(tblREGION.[Region Name]) AS RegionName,

    Cast([obln].[ASSN] As Varchar(5)) AS CostCtr,

    tblASSIGNMENT_UNIT.Description AS CostCtrName,

    OBLN.CONT AS Officer,

    tblOFFICER.[Officer Name] AS OfficerName,

    Cast([obln].[PROC_TP] As Varchar(4)) AS ProcessTyp,

    tblProcessTyp.Description AS ProcessTypDescr,

    Cast(OBLN.GL_CD As Varchar(7)) AS GLCode,

    tblBalanceDetailByObligation.[Gross Outstanding] AS GrossOutstanding,

    tblBalanceDetailByObligation.[Amt Charged-Off] AS [Net Charge-Off],

    Cast(tblBalanceDetailByObligation.[Parti Sold Amt] As Money) AS [Parti Sold Amt],

    tblBalanceDetailByObligation.[Int Paid To Prin],

    tblBalanceDetailByObligation.[Loan Balance End] AS LoanBalanceEnd,

    Cast(FUTURE.COM_BAL As Money) AS FutureAmt,

    Cast(FUTURE.UNSD_AMT As Money) AS FutureUnused,

    tblExposureByObligation.Exposure,

    Cast(OBLN.ORIG_BAL As Money) AS OrigBal,

    AFS_Referential_DB.dbo.fn_DateBlank([ORIG_OBL_DT]) AS OrigOblDt,

    AFS_Referential_DB.dbo.fn_DateBlank([MAT_DT]) AS MaturityDt,

    AFS_Referential_DB.dbo.fn_DateBlank([REN_PST_DT]) AS LastRenewDt,

    OBLN.NO_TMS_REN AS NumberRenewals,

    Cast([obln].[OBL_TP] As Varchar(5)) AS ObligationTyp,

    tblOBGN_TYPES.Description AS ObligationTypDescr,

    Cast([obln].[OBL_COL_TP] As Varchar(5)) AS CollateralTyp,

    tblCollateralType.CollateralTypDescription AS CollareralTypDescr,

    Cast([obln].[PUR_CD] As Varchar(5)) AS PurposeCd,

    tblPurpose.Purpose AS PurposeDescr,

    Cast([obln].[ST_CD] As Varchar(5)) AS StatusCd,

    AFS_Referential_DB.dbo.fn_DateBlank([ST_EFF_DT]) AS StatusCdEffDt,

    OBLN.PD_30_DAYS_CTR AS PDue30Ctr,

    OBLN.PD_60_DAYS_CTR AS PDue60Ctr,

    OBLN.PD_90_DAYS_CTR AS PDue90Ctr,

    OBLN.PD_120_DAYS_CTR AS PDue120Ctr,

    OBLN.PD_150_DAYS_CTR AS PDue150Ctr,

    OBLN.PD_DAYS AS DaysPastDue,

    OBLN.PD_TMS AS PDueTimesCtr,

    OBLN.CR_SCR AS CreditScore,

    AFS_Referential_DB.dbo.fn_DateBlank([CR_DT]) AS CreditScoreDt,

    tblRisk_RatingsCurrent.[Risk Rating] AS RiskRating,

    vw_HarteHanksFeeFileSQL.FASBFeeErndMTD,

    vw_HarteHanksFeeFileSQL.FASBFeeErndYTD,

    vw_HarteHanksFeeFileSQL.FASBFeeErndITD,

    vw_HarteHanksFeeFileSQL.FASBFeePdMTD,

    vw_HarteHanksFeeFileSQL.FASBFeePdYTD,

    vw_HarteHanksFeeFileSQL.FASBFeePdITD,

    vw_HarteHanksFeeFileSQL.FASBExpErndMTD,

    vw_HarteHanksFeeFileSQL.FASBExpErndYTD,

    vw_HarteHanksFeeFileSQL.FASBExpErndITD,

    vw_HarteHanksFeeFileSQL.FASBExpPdMTD,

    vw_HarteHanksFeeFileSQL.FASBExpPdYTD,

    vw_HarteHanksFeeFileSQL.FASBExpPdITD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndMTD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndYTD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndITD,

    vw_HarteHanksFeeFileSQL.OtherFeePdMTD,

    vw_HarteHanksFeeFileSQL.OtherFeePdYTD,

    vw_HarteHanksFeeFileSQL.OtherFeePdITD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvMTD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvYTD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvITD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndMTD As Money) AS LateChrgErndMTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndYTD As Money) AS LateChrgErndYTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndITD As Money) AS LateChrgErndITD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdMTD As Money) AS LateChrgPdMTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdYTD As Money) AS LateChrgPdYTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdITD As Money) AS LateChrgPdITD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvMTD As Money) AS LateChrgWvMTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvYTD As Money) AS LateChrgWvYTD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvITD As Money) AS LateChrgWvITD,

    Cast(vw_HarteHanksInterestFileSQL.InterestErndMTD As Money) AS InterestErndMTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestErndYTD As Money) AS InterestErndYTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestErndITD As Money) AS InterestErndITD,

    Cast(vw_HarteHanksInterestFileSQL.InterestPdMTD As Money) AS InterestPdMTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestPdYTD As Money) AS InterestPdYTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestPdITD As Money) AS InterestPdITD,

    Cast(vw_HarteHanksInterestFileSQL.InterestWvMTD As Money) AS InterestWvMTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestWvYTD As Money) AS InterestWvYTD,

    Cast(vw_HarteHanksInterestFileSQL.InterestWvITD As Money) AS InterestWvITD,

    Cast(vw_HarteHanksRateFileSQL.Rate As Varchar(17)) AS Rate,

    vw_HarteHanksRateFileSQL.[Index],

    vw_HarteHanksRateFileSQL.IndexName,

    vw_HarteHanksRateFileSQL.ChangeDayCd,

    vw_HarteHanksRateFileSQL.CurIndexEffFrDt,

    vw_HarteHanksRateFileSQL.CurIndexEffThruDt,

    Cast(vw_HarteHanksRateFileSQL.BaseRateFactor As Varchar(17)) AS BaseRateFactor,

    vw_HarteHanksRateFileSQL.[BaseRate+-],

    vw_HarteHanksRateFileSQL.AdjVarFixRt,

    Cast(vw_HarteHanksRateFileSQL.RateFloor As Varchar(17)) AS RateFloor,

    Cast(vw_HarteHanksRateFileSQL.RateCeiling As Varchar(17)) AS RateCeiling,

    vw_HarteHanksRateFileSQL.AnniversaryDt,

    vw_HarteHanksRateFileSQL.CurAcrEffFromDt,

    vw_HarteHanksRateFileSQL.CurAcrEffThruDt,

    OBLN.DUR_CD AS DurationCd,

    AFS_Referential_DB.dbo.fn_DateBlank([EST_MAT_DT]) AS EstMaturityDt,

    AFS_Referential_DB.dbo.fn_NewToNewExist([eff_dt], [dt_acct_open], [ren_pst_dt]) AS NewToNewExist,

    OBLG.CR_RTG AS User1,

    vw_DFPPlanUnitsByObligationSQL.[Plan Units] AS User2,

    AFS_Referential_DB.dbo.fn_PotentialClosed([TempPaids].[Obligor],[TempPaids].[Obligation]) AS User3,

    vw_ChargeCode100FromHeaderTable.CURACR_BASIS AS User4,

    Cast(AFS_Referential_DB.dbo.fn_AveOutMTDCumm([Proc_tp],[Mthy_Cumm_Bal], [obln].[ver], [Mthy_Cumm_Bal_NTM]) As Money) AS User5,

    Cast(tblOneObligorExposure.[Lead Obligor] As Varchar(8)) AS User6,

    Cast(OBLN.BK_TAX_CLS As Varchar(1)) AS User7,

    ' ' AS User8,

    ' ' AS User9,

    ' ' AS User10

    FROM

    (((((OBLG INNER JOIN APPL ON OBLG.OBG_NO = APPL.OBG_NO) INNER JOIN ((((((((((((((((OBLN

    LEFT JOIN tblProcessTyp ON OBLN.PROC_TP = tblProcessTyp.ProcessTypCd)

    LEFT JOIN tblDIVISION ON OBLN.DIV = tblDIVISION.Value)

    LEFT JOIN tblREGION ON OBLN.REG = tblREGION.[Region Code])

    LEFT JOIN tblASSIGNMENT_UNIT ON OBLN.ASSN = tblASSIGNMENT_UNIT.Value)

    LEFT JOIN tblOFFICER ON OBLN.CONT = tblOFFICER.Value)

    LEFT JOIN tblOBGN_TYPES ON OBLN.OBL_TP = tblOBGN_TYPES.Value)

    LEFT JOIN tblCollateralType ON OBLN.OBL_COL_TP = tblCollateralType.CollateralTypCd)

    LEFT JOIN tblBalanceDetailByObligation ON (OBLN.OBG_NO = tblBalanceDetailByObligation.OBG_NO) AND (OBLN.OBL_NO = tblBalanceDetailByObligation.OBL_NO))

    LEFT JOIN vw_HarteHanksFeeFileSQL ON (OBLN.OBG_NO = vw_HarteHanksFeeFileSQL.OBG_NO) AND (OBLN.OBL_NO = vw_HarteHanksFeeFileSQL.OBL_NO))

    LEFT JOIN vw_HarteHanksInterestFileSQL ON (OBLN.OBG_NO = vw_HarteHanksInterestFileSQL.OBG_NO) AND (OBLN.OBL_NO = vw_HarteHanksInterestFileSQL.OBL_NO))

    LEFT JOIN vw_HarteHanksLateChrgFileSQL ON (OBLN.OBG_NO = vw_HarteHanksLateChrgFileSQL.OBG_NO) AND (OBLN.OBL_NO = vw_HarteHanksLateChrgFileSQL.OBL_NO))

    LEFT JOIN vw_HarteHanksRateFileSQL ON (OBLN.OBG_NO = vw_HarteHanksRateFileSQL.OBG_NO) AND (OBLN.OBL_NO = vw_HarteHanksRateFileSQL.OBL_NO))

    LEFT JOIN tblPurpose ON OBLN.PUR_CD = tblPurpose.PurposeCd)

    LEFT JOIN tblExposureByObligation ON (OBLN.OBG_NO = tblExposureByObligation.Obligor) AND (OBLN.OBL_NO = tblExposureByObligation.Obligation))

    LEFT JOIN FUTURE ON (OBLN.OBG_NO = FUTURE.OBG_NO) AND (OBLN.OBL_NO = FUTURE.OBL_NO))

    LEFT JOIN OBLN_TRBLDBT_DATA ON (OBLN.OBG_NO = OBLN_TRBLDBT_DATA.OBG_NO) AND (OBLN.OBL_NO = OBLN_TRBLDBT_DATA.OBL_NO)) ON APPL.OBG_NO = OBLN.OBG_NO)

    LEFT JOIN tblRisk_RatingsCurrent ON (OBLN.OBG_NO = tblRisk_RatingsCurrent.Obligor) AND (OBLN.OBL_NO = tblRisk_RatingsCurrent.Obligation))

    LEFT JOIN vw_DFPPlanUnitsByObligationSQL ON (OBLN.OBG_NO = vw_DFPPlanUnitsByObligationSQL.OBG_NO) AND (OBLN.OBL_NO = vw_DFPPlanUnitsByObligationSQL.OBL_NO))

    LEFT JOIN TempPaids ON (OBLN.OBG_NO = TempPaids.Obligor) AND (OBLN.OBL_NO = TempPaids.Obligation))

    LEFT JOIN [vw_ChargeCode100FromHeaderTable] ON (OBLN.OBG_NO = [vw_ChargeCode100FromHeaderTable].OBG_NO) AND (OBLN.OBL_NO = [vw_ChargeCode100FromHeaderTable].OBL_NO)

    LEFT JOIN tblOneObligorExposure ON OBLG.OBG_NO = tblOneObligorExposure.Obligor

    WHERE

    (((OBLN.PROC_TP)<2000)

     AND ((OBLN.OBG_NO)<>50845655)

     AND ((FUTURE.CLS_IND)<>1))

    OR

    (((OBLN.PROC_TP)>=3000 And (OBLN.PROC_TP)<5000)

     AND ((OBLN.OBG_NO)<>50845655)

     AND ((FUTURE.CLS_IND)<>1))

    OR

    (((OBLN.PROC_TP)>=5000)

     AND ((OBLN.OBG_NO)<>50845655)

     AND ((OBLN_TRBLDBT_DATA.FROZ_ST_FLAG)<>1))

    OR

    (((OBLN.PROC_TP)>=5000)

     AND ((OBLN.OBG_NO)<>50845655)

     AND ((OBLN_TRBLDBT_DATA.FROZ_ST_FLAG)=1)

     AND ((OBLN.CUR_BAL)<>0))

    GROUP BY

    AFS_Referential_DB.dbo.fn_FileDateText([obln].[ver]),

    Cast([obln].[OBG_NO] As Varchar(8)),

    Cast([obln].[OBL_NO] As Varchar(10)),

    Cast([obln].[obg_no] As Varchar(8)) + Cast('-' As Varchar(1)) + Cast([obln].[obl_no] As Varchar(10)),

    RTrim(AFS_Referential_DB.dbo.fn_CustName([NAME])),

    RTrim(OBLG.ADDR_1),

    RTrim(OBLG.ADDR_2),

    RTrim(OBLG.ADDR_3),

    RTrim(OBLG.CITY),

    OBLG.ST,

    Left([ZIP],5),

    RTrim(Substring([zip],6,4)),

    AFS_Referential_DB.dbo.fn_TaxID([ssn],[TAX_IDENT]),

    RTrim(OBLG.TELE_1),

    RTrim(OBLG.TELE_2),

    RTrim(APPL.SIC_CD),

    Cast([obln].[SRV] As Varchar(5)),

    AFS_Referential_DB.dbo.fn_ServUnitName([obln].[srv]),

    Cast([obln].

    As Varchar(5)),

    RTrim(tblDIVISION.Description),

    Cast([obln].[REG] As Varchar(5)),

    RTrim(tblREGION.[Region Name]),

    Cast([obln].[ASSN] As Varchar(5)),

    tblASSIGNMENT_UNIT.Description,

    OBLN.CONT,

    tblOFFICER.[Officer Name],

    Cast([obln].[PROC_TP] As Varchar(4)),

    tblProcessTyp.Description,

    OBLN.GL_CD,

    tblBalanceDetailByObligation.[Gross Outstanding],

    tblBalanceDetailByObligation.[Amt Charged-Off] ,

    Cast(tblBalanceDetailByObligation.[Parti Sold Amt] As Money),

    tblBalanceDetailByObligation.[Int Paid To Prin],

    tblBalanceDetailByObligation.[Loan Balance End],

    Cast(FUTURE.COM_BAL As Money),

    Cast(FUTURE.UNSD_AMT As Money),

    tblExposureByObligation.Exposure,

    Cast(OBLN.ORIG_BAL As Money),

    AFS_Referential_DB.dbo.fn_DateBlank([ORIG_OBL_DT]),

    AFS_Referential_DB.dbo.fn_DateBlank([MAT_DT]),

    AFS_Referential_DB.dbo.fn_DateBlank([REN_PST_DT]) ,

    OBLN.NO_TMS_REN,

    Cast([obln].[OBL_TP] As Varchar(5)),

    tblOBGN_TYPES.Description,

    Cast([obln].[OBL_COL_TP] As Varchar(5)),

    tblCollateralType.CollateralTypDescription,

    Cast([obln].[PUR_CD] As Varchar(5)),

    tblPurpose.Purpose,

    Cast([obln].[ST_CD] As Varchar(5)),

    AFS_Referential_DB.dbo.fn_DateBlank([ST_EFF_DT]),

    OBLN.PD_30_DAYS_CTR,

    OBLN.PD_60_DAYS_CTR,

    OBLN.PD_90_DAYS_CTR,

    OBLN.PD_120_DAYS_CTR,

    OBLN.PD_150_DAYS_CTR,

    OBLN.PD_DAYS,

    OBLN.PD_TMS,

    OBLN.CR_SCR,

    AFS_Referential_DB.dbo.fn_DateBlank([CR_DT]),

    tblRisk_RatingsCurrent.[Risk Rating],

    vw_HarteHanksFeeFileSQL.FASBFeeErndMTD,

    vw_HarteHanksFeeFileSQL.FASBFeeErndYTD,

    vw_HarteHanksFeeFileSQL.FASBFeeErndITD,

    vw_HarteHanksFeeFileSQL.FASBFeePdMTD,

    vw_HarteHanksFeeFileSQL.FASBFeePdYTD,

    vw_HarteHanksFeeFileSQL.FASBFeePdITD,

    vw_HarteHanksFeeFileSQL.FASBExpErndMTD,

    vw_HarteHanksFeeFileSQL.FASBExpErndYTD,

    vw_HarteHanksFeeFileSQL.FASBExpErndITD,

    vw_HarteHanksFeeFileSQL.FASBExpPdMTD,

    vw_HarteHanksFeeFileSQL.FASBExpPdYTD,

    vw_HarteHanksFeeFileSQL.FASBExpPdITD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndMTD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndYTD,

    vw_HarteHanksFeeFileSQL.OtherFeeErndITD,

    vw_HarteHanksFeeFileSQL.OtherFeePdMTD,

    vw_HarteHanksFeeFileSQL.OtherFeePdYTD,

    vw_HarteHanksFeeFileSQL.OtherFeePdITD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvMTD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvYTD,

    vw_HarteHanksFeeFileSQL.OtherFeeWvITD,

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndMTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndYTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgErndITD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdMTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdYTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgPdITD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvMTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvYTD As Money),

    Cast(vw_HarteHanksLateChrgFileSQL.LateChrgWvITD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestErndMTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestErndYTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestErndITD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestPdMTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestPdYTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestPdITD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestWvMTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestWvYTD As Money),

    Cast(vw_HarteHanksInterestFileSQL.InterestWvITD As Money),

    Cast(vw_HarteHanksRateFileSQL.Rate As Varchar(17)),

    vw_HarteHanksRateFileSQL.[Index],

    vw_HarteHanksRateFileSQL.IndexName,

    vw_HarteHanksRateFileSQL.ChangeDayCd,

    vw_HarteHanksRateFileSQL.CurIndexEffFrDt,

    vw_HarteHanksRateFileSQL.CurIndexEffThruDt,

    Cast(vw_HarteHanksRateFileSQL.BaseRateFactor As Varchar(17)),

    vw_HarteHanksRateFileSQL.[BaseRate+-],

    vw_HarteHanksRateFileSQL.AdjVarFixRt,

    Cast(vw_HarteHanksRateFileSQL.RateFloor As Varchar(17)),

    Cast(vw_HarteHanksRateFileSQL.RateCeiling As Varchar(17)),

    vw_HarteHanksRateFileSQL.AnniversaryDt,

    vw_HarteHanksRateFileSQL.CurAcrEffFromDt,

    vw_HarteHanksRateFileSQL.CurAcrEffThruDt,

    OBLN.DUR_CD,

    AFS_Referential_DB.dbo.fn_DateBlank([EST_MAT_DT]),

    AFS_Referential_DB.dbo.fn_NewToNewExist([eff_dt], [dt_acct_open], [ren_pst_dt]),

    OBLG.CR_RTG,

    vw_DFPPlanUnitsByObligationSQL.[Plan Units],

    AFS_Referential_DB.dbo.fn_PotentialClosed([TempPaids].[Obligor],[TempPaids].[Obligation]),

    vw_ChargeCode100FromHeaderTable.CURACR_BASIS,

    Cast(AFS_Referential_DB.dbo.fn_AveOutMTDCumm([Proc_tp],[Mthy_Cumm_Bal], [obln].[ver], [Mthy_Cumm_Bal_NTM]) As Money),

    Cast(tblOneObligorExposure.[Lead Obligor] As Varchar(8)),

    Cast(OBLN.BK_TAX_CLS As Varchar(1))

    ORDER BY

    Cast([obln].[OBG_NO] As Varchar(8)),

    Cast([obln].[OBL_NO] As Varchar(10)),

    Cast([obln].[obg_no] As Varchar(8)) + Cast('-' As Varchar(1)) + Cast([obln].[obl_no] As Varchar(10)),

    RTrim(AFS_Referential_DB.dbo.fn_CustName([NAME]));

    GO

  • You could try checking to see if any of the VIEWs point to a different server.

    Also, as you do not seem to be using any aggregate functions, you could remove the GROUP BY and just use SELECT DISTINCT.

    [Edit] Also, I think the ORDER BY can be reduced to ORDER BY UnqID, ObligorName

     

     

  • Did you change this stored procedure after applying SP4? If so, it is not surprising.

    Did you have a lot of changes in your data after applying SP4? If so, did you restart SQL Server? If not, you may need to recompile this stored procedure.

    Otherwise, I am exhausted my idea at this moment. I would like to know if any other fact we should look into.

     

  • This reply has been reported for inappropriate content.

    O casino mostbet-pte.com oferece a oportunidade de tentar a sorte e desfrutar de jogos de azar e apostas desportivas. Este é um casino online legal em Portugal que o pode fazer feliz. Aqui você encontrará um grande número de jogos populares, incluindo slots, jogos de mesa e um cassino ao vivo com dealers. Bônus generosos e promoções regulares tornarão o seu tempo ainda mais agradável. Faça apostas e jogue imediatamente após o registro.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply