Forum Replies Created

Viewing 15 posts - 496 through 510 (of 2,458 total)

  • RE: Window Function Question - 3 month rolling average

    Just looking at this again, it appears (based on your sample data) that you are looking to do a rolling 3 year average. In that case, you want something like...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Window Function Question - 3 month rolling average

    A couple things.

    First, the order by company in your window clause does not make any sense, I think you want it to be sorting by a date. Second, you...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Do distinct inside SSRS report

    There are some scripts out there for how to add custom code to your report, you can also handle this through doing some SSRS grouping but each of these options...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Searching set of words by ignoring spaces

    MMartin1 (8/26/2016)


    DECLARE @text VARCHAR(100);

    SET @text= ' set

    nocounto

    n

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: XML Stream Reader

    The conventional wisdom is to use Linq to stream XML data. Note this article. I have never used Linq and have heard that it's slow for this; nonetheless, that's one...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Today's Random Word!

    djj (8/25/2016)


    Ed Wagner (8/25/2016)


    Y.B. (8/25/2016)


    ZZartin (8/25/2016)


    Ray K (8/25/2016)


    crookj (8/25/2016)


    Ed Wagner (8/25/2016)


    Alan.B (8/25/2016)


    BWFC (8/25/2016)


    Prefect

    day

    Night

    Stalker

    Talker

    Dead

    Walking

    Running

    Jogging

    blogging

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Up, Up, and Away

    I traveled a lot before my daughter was born and loved it. Since my daugther was born, I only travel when then wife and kid can come with. We're all...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: WeekNumners to be renamed

    We need more info but here's some code that may help:

    -- (1) Some sample data, a sample calendar table for a specific year

    IF OBJECT_ID('tempdb..#calendar') IS NOT NULL DROP TABLE #calendar;

    DECLARE...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Top SQL queries based on CPU usage and execution time

    You can download this book for free: Performance Tuning With SQL Server Dynamic Management Views and it has the queries you are looking for.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL help - how do we find that a particular string appears x times in a certain field

    Thx but that is not really the challenge...

    What I need is an expression that will give me the 3 letters that follow the nth occurrence of the key word if...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL help - how do we find that a particular string appears x times in a certain field

    Matt Miller (#4) (8/25/2016)


    I'm sorry if I am taking the fun out of building a SQL only solution, but there are lots of basic samples of SQLCLR showing how to...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Searching set of words by ignoring spaces

    Luis Cazares (8/25/2016)


    The Dixie Flatline (8/25/2016)


    But isn't the problem with just replacing spaces is that it doesn't deal with other special characters?

    It depends on what you're doing.

    My strategy (which varies...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Searching set of words by ignoring spaces

    ScottPletcher (8/25/2016)


    Rather than literal strings of spaces, I recommend using SPACE(), just for readability:

    /*CREATE FUNCTION ...*/

    SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LTRIM(RTRIM(@Text)),

    SPACE(33), ' '),

    SPACE(17), ' '),

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: difference betwwn inner join and intersect in sql

    Joins are one of the four table operators in MS SQL Server (the others are APPLY, PIVOT and UNPIVOT). Joins are used for joining tables (real or derived).

    INTERSECT, EXCEPT, UNION...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Today's Random Word!

    BWFC (8/25/2016)


    Prefect

    day

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 496 through 510 (of 2,458 total)