Forum Replies Created

Viewing 15 posts - 481 through 495 (of 5,843 total)

  • RE: Multiple Index Suggestions

    alex.sqldba (1/5/2017)


    Afternoon Guys,

    I suspect the answer to my question will be along the lines of YMMV, but I'll ask it anyway 🙂

    When looking through some execution plans earlier for some...

  • RE: Merge consecutive rows into single row

    Jeff Moden (1/5/2017)


    Why not just replace the embedded carriage returns with an empty string?

    This gets my vote. Fix the data before or during load into SQL Server.

  • RE: Deadlock Problem on a Heap Table

    lmarkum (1/5/2017)


    TheSQLGuru (1/3/2017)


    1) You have extra BEGIN TRAN's in the sproc. You should just have one at the very top and the very bottom.

    2) You should have some explicit error...

  • RE: Grouping - Group By Results - Into combined groups

    Lots of issues/questions here

    1) You cannot do an average of an average, which it seems you are asking for.

    2) You want Adam 1 through Adam 5 combined. What rules allow...

  • RE: Deadlock Problem on a Heap Table

    1) You have extra BEGIN TRAN's in the sproc. You should just have one at the very top and the very bottom.

    2) You should have some explicit error checking in...

  • RE: Finding First Occurrence in a given year

    With your requirements amendment I think Drew's modification to my query should get you what you want.

  • RE: Finding First Occurrence in a given year

    TheSQLGuru (1/3/2017)


    It would be helpful to have sample data and expected output. But I am thinking something like this:

    select year(awarddate), employeeid, min(awarddate)

    from sometable

    where awardflag = 1

    group by awarddate, employeeid

    I should...

  • RE: Finding First Occurrence in a given year

    It would be helpful to have sample data and expected output. But I am thinking something like this:

    select year(awarddate), employeeid, min(awarddate)

    from sometable

    where awardflag = 1

    group by awarddate, employeeid

  • RE: Deadlock Problem on a Heap Table

    I had a really awesome reply almost finished last night, with sample scripts and data and plan analysis. I couldn't finish it before going to bed though and when I...

  • RE: T-SQL-Counting Occurrences over a rolling 12 month period

    Here is another solution. I didn't benchmark this solution against the million row table, but I expect it to perform more efficiently based on simplicity even if the POC index...

  • RE: Deadlock Problem on a Heap Table

    Sergiy (1/1/2017)


    Every index has statistics on it, and statistics could suggest optimiser that the date selection is ultimately selective.

    I'm sorry Sergiy, but that is absolutely not the case. The optimizer...

  • RE: Deadlock Problem on a Heap Table

    Jeff:

    "If the NCI had a leading column of the TrackingNumber and there's only one of each tracking number in the table, how do you figure that would result in a...

  • RE: Deadlock Problem on a Heap Table

    Jeff Moden (12/30/2016)


    TheSQLGuru (12/30/2016)


    Jeff Moden (12/30/2016)


    TheSQLGuru (12/30/2016)


    Jeff: "Another potentially very serious problem with all of this is the idea that a lot of the rows will suffer a lot of...

  • RE: Deadlock Problem on a Heap Table

    lmarkum (12/30/2016)


    TheSQLGuru (12/30/2016)


    lmarkum (12/30/2016)


    Sergiy (12/30/2016)


    lmarkum (12/23/2016)


    I also dropped the non-clustered index IX_UPSTracking on just TrackingNumber since that seemed redundant to the new clustered PK and another existing...

  • RE: Deadlock Problem on a Heap Table

    lmarkum (12/30/2016)


    Sergiy (12/30/2016)


    lmarkum (12/23/2016)


    I also dropped the non-clustered index IX_UPSTracking on just TrackingNumber since that seemed redundant to the new clustered PK and another existing index IX_UPSTracking...

Viewing 15 posts - 481 through 495 (of 5,843 total)