Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

SQL condition "63 Query timeout expired" just comes and goes

Posted on by 1,642

A couple of times I've encountered a situation in which SQL Server yields the following condition:

SQL Server Message 63: [Microsoft][SQL Server Native Client 10.0]Query timeout expired

This happening with any action update-worthy under Dynamics SL 2011.

I've checked out some tips, like KB2551478. I have no FRX installation. There are some custom triggers setup, but all of them have the "set no count" statement.

We also scan for deadlocks, but none appears. What strikes me most is that this behavior stops after some 40-90 minutes. I'm still without a clue on what started or what stopped this.

We've tried the following:

  • Restarting the SQL service.
  • Kill some idle SQL sessions. We run an Application Server that seems to leave lingering sessions. 
  • Enable/Disable selected triggers.
  • We also check out our SQL server health. No indication of overload or system errors.

After all this actions, most of them nonsense guesses, the behavior is still the same. Then after a while, the problem stops and back to normal again.

Anyone has found some light on this?

*This post is locked for comments

  • Brian_IL Profile Picture
    Brian_IL 715 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    The SQL script FRx_SL2011_93Fix (below) is extracted from the zip file B2551470_FRx_SL2011_93Fix. I can provide the zip file if needed. As noted before, the triggers have SET NOCOUNT ON added to the start of each, there didn't appear to be any other changes to the triggers being updated. Adding that command to other user created triggers may be the desired solution to fix error 93 when releasing a batch..

    --delete from frl_acct_code
    alter trigger frx_frl_acct_code_insert
    on frl_acct_code
    For Insert
    as
    Begin
    SET NOCOUNT ON
    If ((select count(*) from inserted) = 0) goto eof
    DECLARE @MaxSegs int
    DECLARE @NatSegLen tinyint
    DECLARE @SegLen2 tinyint
    DECLARE @SegLen3 tinyint
    DECLARE @SegLen4 tinyint
    DECLARE @SegLen5 tinyint
    DECLARE @SegLen6 tinyint
    DECLARE @SegLen7 tinyint
    DECLARE @SegLen8 tinyint
    DECLARE @SegLen9 tinyint
    DECLARE @SubLen tinyint

    SELECT @MaxSegs = NumberSegments + 1,
    @SegLen2 = SegLength00,
    @SegLen3 = SegLength01,
    @SegLen4 = SegLength02,
    @SegLen5 = SegLength03,
    @SegLen6 = SegLength04,
    @SegLen7 = SegLength05,
    @SegLen8 = SegLength06,
    @SegLen9 = SegLength07,
    @SubLen = SegLength00 + SegLength01 + SegLength02 + SegLength03 +
    SegLength04 + SegLength05 + SegLength06 + SegLength07
    FROM FlexDef
    WHERE FieldClassName = 'SUBACCOUNT'

    select @NatSegLen = nat_seg_len from frl_glx_ctrl
    update frl_acct_code set
    Acct_Code = substring(Acct, 1, @NatSegLen) + substring(Sub, 1, @SubLen)
    ,nat_seg_code = substring(acct, 1, @NatSegLen)
    ,seg01_code =substring(Acct, 1, @NatSegLen)
    ,seg02_code = substring(Sub, 1, @SegLen2)
    ,seg03_code = substring(Sub, 1 + @SegLen2, @SegLen3)
    ,seg04_code =substring(Sub, 1 + @SegLen2 + @SegLen3, @SegLen4)
    ,seg05_code =substring(Sub, 1 + @SegLen2 + @SegLen3 + @SegLen4, @SegLen5)
    ,seg06_code = substring(Sub, 1 + @SegLen2 + @SegLen3 + @SegLen4 + @SegLen5, @SegLen6)
    ,seg07_code = substring(Sub, 1 + @SegLen2 + @SegLen3 + @SegLen4 + @SegLen5 + @SegLen6, @SegLen7)
    ,seg08_code = substring(Sub, 1 + @SegLen2 + @SegLen3 + @SegLen4 + @SegLen5 + @SegLen6 + @SegLen7, @SegLen8)
    ,seg09_code = substring(Sub, 1 + @SegLen2 + @SegLen3 + @SegLen4 + @SegLen5 + @SegLen6 + @SegLen7 + @SegLen8, @SegLen9)
    from frl_acct_code where entity_num = -255
    if (select top 1 ValidateAcctSub from GLSetup WITH (nolock)) = 1
    begin
    update frl_acct_code set
    acct_status =
    CASE
    WHEN active = 1 THEN 0
    WHEN active = 0 THEN 1
    END,
    acct_desc = descr
    FROM frl_acctsub_view
    WHERE frl_acctsub_view.acct = frl_acct_code.acct
    AND frl_acctsub_view.sub = frl_acct_code.sub
    AND frl_acctsub_view.cpnyid = frl_acct_code.cpnyid
    AND frl_acct_code.entity_num = -255
    -- try and update fields from frl_acctsub_view
    update frl_acct_code set
    acct_status =
    CASE
    WHEN active = 1 THEN 0
    WHEN active = 0 THEN 1
    END,
    acct_desc = descr
    FROM account
    WHERE account.acct = frl_acct_code.acct
    and frl_acct_code.acct_status = 255
    and entity_num = -255

    --now for account group/normal_bal rule
    update frl_acct_code set
    normal_bal =
    case
    when substring(accttype, 2, 1) = 'A' THEN 1
    when substring(accttype, 2, 1) = 'E' THEN 1
    when substring(accttype, 2, 1) = 'L' THEN 2
    when substring(accttype, 2, 1) = 'I' THEN 2
    end,
    acct_group=
    case
    when substring(accttype, 2, 1) = 'A' THEN 1
    when substring(accttype, 2, 1) = 'L' THEN 2
    when substring(accttype, 2, 1) = 'E' THEN 3
    when substring(accttype, 2, 1) = 'I' THEN 4
    end
    from account
    where account.acct = frl_acct_code.acct
    and frl_acct_code.entity_num = -255

    update frl_acct_code set acct_group = 1,normal_bal = 1 where frl_acct_code.normal_bal =0
    END
    else --if (select ValidateAcctSub from GLSetup WITH (nolock)) = 1
    begin
    UPDATE frl_acct_code set
    acct_status =
    CASE
    WHEN active = 1 THEN 0
    WHEN active = 0 THEN 1
    END,
    acct_desc = descr,
    normal_bal =
    CASE
    WHEN substring(accttype, 2, 1) = 'A' THEN 1
    WHEN substring(accttype, 2, 1) = 'E' THEN 1
    WHEN substring(accttype, 2, 1) = 'L' THEN 2
    WHEN substring(accttype, 2, 1) = 'I' THEN 2
    END,
    acct_group =
    CASE
    WHEN substring(accttype, 2, 1) = 'A' THEN 1
    WHEN substring(accttype, 2, 1) = 'L' THEN 2
    WHEN substring(accttype, 2, 1) = 'E' THEN 3
    WHEN substring(accttype, 2, 1) = 'I' THEN 4
    END
    from account
    where account.acct = frl_acct_code.acct and entity_num = -255 and acct_status = 255
    end

    delete from frl_acct_code where len(rtrim(sub)) > @SubLen and entity_num = -255

    update frl_acct_code set entity_num =isnull(( select entity_num from frl_entity where frl_entity.cpnyid = frl_acct_code.CpnyID),-1) where entity_num = -255

    eof:
    --SET NOCOUNT OFF
    END

    go


    alter trigger frx_gltran_insert
    on gltran
    for insert, update
    as
    begin
    SET NOCOUNT ON
    insert frl_acct_code (
    acct,acct_code,acct_desc,acct_group,acct_status,cpnyid,
    entity_num,nat_seg_code,normal_bal,
    seg01_code,seg02_code,seg03_code,seg04_code,seg05_code,seg06_code,seg07_code,seg08_code,seg09_code,sub)
    select distinct t1.acct,' ', ' ' , 0 , 255
    , t1.cpnyid
    , -255 , ' ' , 0 , ' ' , ' '
    , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , t1.sub from inserted t1
    left join frl_acct_code t2
    on t1.cpnyid = t2.cpnyid and t1.acct = t2.acct and t1.sub = t2.sub
    WHERE t1.posted = 'U' and rlsed = 1 and t2.acct is null
    --SET NOCOUNT OFF

    END

  • Cherie Kane Profile Picture
    Cherie Kane 595 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    Does anyone have the B2551470_FRx_SL2011_93Fix.zip file?  I am having this same issue at a client running SL 2015 CU2 with FRx and everything else I've tried doesn't work for this user.

  • CoeAne Profile Picture
    CoeAne 5 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    Just had the same issue, reason was that the acctxref tables use execute as the 07718158D19D4f5f9D23B55DBF5DF1 user to run those triggers. upon further investigation the 07718158D19D4f5f9D23B55DBF5DF1 user was actually disabled under SQL security. Enabled the user, refreshed the instance. seems to do the trick.

  • Brian_IL Profile Picture
    Brian_IL 715 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    I had the same issue with an SL2011 installation, where they were unable to release a GL batch once they had one batch hang up with the SQL Query Timeout - SQL Message 63; also seen in SQL as SqlState = HYT00 NativeError = 0 err=63. Restarting SQL and clearing orphaned sessions from the Access table still left them unable to release the GL batch. Clearing the WrkRelease table of the record for this batch (normally done by stored proc pp_01400) also had no effect.

    They resolved the problem by adding the "Set NOCount ON" command to three triggers that existed on the AcctXref and AcctSub tables in the SL System DB: sDeleteAcctXref_dbname, sInsertAcctXref_dbname, sUpdateAcctXref_dbname, and similar trigger names on AcctSub. 

    Like Mark's observation, there seems to be no reason why this issue suddenly appeared. Altering the 6 triggers defined on these 2 tables did resolve the issue.

  • Erich Strelow F Profile Picture
    Erich Strelow F 1,642 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    I haven't found an answer. The Query Timeout still occurs every 3 months or so. I'm going to check out the triggers in the System DB you mention, since clearly I have overlooked them.

  • Mark E Profile Picture
    Mark E 6,405 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    Just resolved this one on my end, but not sure why the error started occurring, or why it never happened before.  In the System DB, there are standard triggers on the AcctSub and AcctXRef tables.  None of those triggers contained the SET NOCOUNT ON switch.  Once I added to all the triggers (there are 3 in each table per Company), the problem went away.  I took a look at some other installs, and the SET NOCOUNT ON is not part of those triggers in those databases.  Weird....

  • Mark E Profile Picture
    Mark E 6,405 on at
    RE: SQL condition "63 Query timeout expired" just comes and goes

    Wondering if you found a resolution to this issue?  Just randomly started to happen at one of my installs, trying to release AP batches.  there are some custom triggers and procs, but all have the SET NOCOUNT ON set, and none of them were recently modified.  Running SL 2015 CU2 since 11/2018, and this just started today out of nowhere.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans