Forum Replies Created

Viewing 15 posts - 16 through 30 (of 428 total)

  • RE: Getting an average UPDATED

    Hmm, you are grouping by the same columns you are averaging, so that probably isn't giving you what you want. 
    Also the OVER clause is only being applied to the...

  • RE: Getting an average UPDATED

    Hmm, it shouldn't.  I suspect the error is actually somewhere else.  
    The aliases I put on the average column results are invalid because they start with a number.  Try removing...

  • RE: Getting an average UPDATED

    Ah, so for every row, you want to average each of the SSI columns for all rows within 24 hours prior to the current row date/time?

    I doubt this...

  • RE: Grouping Data into categories based on dates

    Sorry I didn't figure you needed the end date, since you have it as the start date of the next row. 
    If you really need that on the same...

  • RE: Getting an average UPDATED

    What are you stuck on?

  • RE: Grouping Data into categories based on dates

    Would something like this work for you?


    SELECT
        Location,
        DateValue, Sum(Number)
    FROM
        #_tempData TheData
    JOIN
        (
            SELECT     StartDate AS DateValue
            FROM...

  • RE: No alternative but row-by-row processing?

    Lynn Pettis - Monday, May 21, 2018 12:37 PM

    sestell1 - Monday, May 21, 2018 12:35 PM

    May 21, 2018 at 2:57 pm

    #1991350

  • RE: No alternative but row-by-row processing?

    Here's an example using just table joins:


    ;WITH TabData (Code, Date, Type)
    AS
    (
        SELECT
            Code, Date, type
        FROM
            @tabData
    )
    SELECT
        Full_Data.Code,

  • RE: TRY_CAST in the WHERE clause.

    Should the SELECT have a try_cast in it as well?
    My understanding is that with larger data sets, it is possible for the optimizer to validate results before applying filters.

  • RE: Special characters

    Three or those are included due to commas in the name, which have not been excluded by the pattern.  I think you are past the problem of special characters in...

  • RE: Special characters

    Interesting... it looks like escaping the square brackets only works when you explicitly specify the escape character for some reason?

    Give this a shot:


    DECLARE...

  • RE: Special characters

    The underscore is a single character wildcard in LIKE expressions.
    You'll need to encapsulate it in square brackets:


    Select * 
    from [XLSFiles] 
    where fullimagepath like '%[^a-zA-Z0-9.&[_]-#$\\()...

  • RE: Cursor Set Condition Variable

    Add another variable to hold the previous group value, so you can store the current and previous values in variables.
    On each loop, update current value via cursor, compare it...

  • RE: Detaching CDC

    fritsvanruyven - Thursday, April 12, 2018 2:21 AM

    The right explanation is "If a database is detached and attached to the same server...

  • RE: Side by Side Support

    diego.perdices - Monday, March 19, 2018 7:36 AM

    Tricky question cause SQL Server 2005 is only supported in Windows Server 2008 or below,...

Viewing 15 posts - 16 through 30 (of 428 total)