Forum Replies Created

Viewing 15 posts - 1,741 through 1,755 (of 10,144 total)

  • RE: Five previous working days

    hoseam (2/17/2016)


    Can I get different columns like 'Today', 'Yesterday', 'A day before Yesterday', '3 days prior Today' and '4 days prior Today'?

    SELECT

    [Today] = MAX(CASE WHEN rn = 5 THEN...

  • RE: Five previous working days

    hoseam (2/17/2016)


    Hi

    I'm struggling to write a code to get five previous working days. I'm trying to get 'Today', 'Yesterday', 'A day before Yesterday', '3 days prior Today' and '4 days...

  • RE: ROW_NUMBER() function with a difference

    The dual-rownumber method is also promising:

    DROP TABLE #Sample

    CREATE TABLE #Sample (pkLocalPatientLocalID VARCHAR(2),pkSpellLocalID VARCHAR(3),WardLocation VARCHAR(20),WardSequence INT,RoomName VARCHAR(20),Bed INT,BedSequence INT,StartDateTime DATETIME,FinishDateTime DATETIME,[WardSequence Required] INT)

    INSERT INTO #Sample

    (pkLocalPatientLocalID,pkSpellLocalID,WardLocation, WardSequence,RoomName, Bed, BedSequence, StartDateTime, FinishDateTime,...

  • RE: Are the posted questions getting worse?

    SQLRNNR (2/16/2016)


    jasona.work (2/16/2016)


    GilaMonster (2/16/2016)


    Cthulhu for president! Why vote for the lesser evil?

    I'm leaning towards the Palpatine / Vader ticket myself...

    Or if they don't make it, Bill and Opus...

    (I refuse to...

  • RE: Are the posted questions getting worse?

    Lynn Pettis (2/16/2016)


    The real problem is that those that govern have forgotten who are the masters and who are the servants. Government is supposed to the servants of the...

  • RE: Are the posted questions getting worse?

    GilaMonster (2/16/2016)


    Cthulhu for president! Why vote for the lesser evil?

    Cthulhu's already president - of the "other" united states.

  • RE: Help with understanding how SQL behaves with inner joins

    -- the DISTINCT appears to be redundant, there were the same number of rows either side of the distinct sort operator.

    SELECT

    o.sys_key, -- "o" is the alias for table...

  • RE: Help with understanding how SQL behaves with inner joins

    nadersam (2/16/2016)


    What i need to check is the index scan on Patient table.

    This is a big table and accessed by most functions in system.

    Is there anyway to reduce the count...

  • RE: purging old data and outer joins

    Orlando Colamatteo (2/15/2016)


    Can you try it in order from most rows to least, see Jeff's follow-up post to mine. The thought being to reduce the set as much as possible...

  • RE: Are the posted questions getting worse?

    Jeff Moden (2/15/2016)


    TomThomson (2/15/2016)


    Jeff Moden (2/15/2016)


    Sean Lange (2/15/2016)


    Grant Fritchey (2/15/2016)


    Hugo Kornelis (2/15/2016)


    jasona.work (2/15/2016)


    So, a question for everyone:

    How do you feel if someone comes back and tells you that they tested...

  • RE: Are the posted questions getting worse?

    jasona.work (2/15/2016)


    So, a question for everyone:

    How do you feel if someone comes back and tells you that they tested a solution you provided before they told their bosses it was...

  • RE: Help to optimize a SP

    SQL!$@w$0ME (2/12/2016)


    Thanks, Please see the actual plan attached.

    1. Can you amend the index as suggested earlier?

    2. Can you run it with sensible parameters such that it returns a result set?

  • RE: Help to optimize a SP

    SQL!$@w$0ME (2/12/2016)


    Tks. I've attached the sqlplan.

    Add ActivityDescription as an INCLUDE column to index [IX_Activity_ActivityCodeId_DeletedAt_CaseId_ActivityDate], it's currently showing as 78% of the total cost of the query and masking everything else....

  • RE: Help to optimize a SP

    SQL!$@w$0ME (2/12/2016)


    Tks. I've attached the sqlplan.

    That's the estimated plan. Can you post the actual plan please?

  • RE: Help to optimize a SP

    SQL!$@w$0ME (2/12/2016)


    Could you guys please review the attached Stored Procedure and advise if optimization is needed.

    -- Stored Procedure

    CREATE procedure [dbo].[PeerReviewsGet]

    as

    begin

    select Review_tab.ReviewId CustomerReferralId,

    Review_tab.ActivityId ReviewActivityId,

    ImeEventDetail.Id ImeEventDetailId,

    activity.Id ActivityId,

    caseinfo.casenum as CaseNumber,

    convert(varchar, ImeEventDetail.ImeEventId) + ImeEventDetail.Extension...

Viewing 15 posts - 1,741 through 1,755 (of 10,144 total)