Forum Replies Created

Viewing 15 posts - 2,206 through 2,220 (of 4,085 total)

  • RE: SQL help - how to write a query with reference to its own results

    sanda.jan00 (10/29/2016)


    Thanks a lot from both of you!!!

    Now, consider the adjusted table provided by you, could you pls give me some advice how to write my query?? 🙂

    You still haven't...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Speeding Up Delete's on Large Databases

    Suth (10/28/2016)


    indicies ? do you mean indexes ?

    Indices is the original Latin plural of index. Indexes is the Anglicized version of the plural. Both are acceptable in English....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Strange result using SUM with ISNULL(NULLIF...

    david.jack (10/28/2016)


    ScottPletcher (10/27/2016)


    Seems more confusing than the natural CASE statement to me:

    SUM(CASE WHEN VAL1 <> 0 THEN VAL1 ELSE VAL2 END)

    VAL1 can return NULL unfortunately so using a comparison operator...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: String or binary data would be truncated. Error when inserting empty table results into TEMP table

    steve.bradford (10/27/2016)


    Are any records returned if you use DATALENGTH(ID) > 15? LEN() automatically trims.

    Since this thread is almost three years old and the OP hasn't made any recent updates,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Recursive CTE performance improvement

    I think that this approach may still be faster, especially with the right indexes in place. I created a Student table, a SchoolDay table, and the TruantDay. I...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Recursive CTE performance improvement

    Does your TruantDay table only contain absences or does it contain all attendance information? If it's all information, there is a much faster approach.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Recursive query with two parents

    I think the only problem with your original query was using the ChildID from the wrong table in the second part of the rCTE.

    DECLARE @Temp TABLE (descr CHAR(5), ChildID TINYINT,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Stuck on simple XML

    Actually, XML uses Unix-style line terminators (LF) rather than Windows-style (CR/LF), so it's not necessary to test for CHAR(13) unless the XML document specifically contains the character encoding for CR...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Stuck on simple XML

    btio_3000 (10/27/2016)


    declare @xml xml =

    '<root>

    <name>hand

    <val>strong</val>

    </name>

    <name>mind

    <val>beautiful</val>

    </name>

    </root>'

    I need to return val...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Please help to fix this query for listing object permissions for all dbs in an instance

    sp_MSforeachDB does not automatically change the context to each database, so it executes in the context of the database where you originally run the query. Preface your dynamic SQL...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Can anyone help optimize runtime on a dimension creating query?

    Actually, the problem is that you're converting int to char back to int. If you want integers keep them as integers.

    DECLARE @START_DT AS datetime = '2015-01-01 00:00:00.000';

    WITH E1 AS...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select exclusive ids comparing master list with two sub lists

    Depending on what indexes you have in place, one of these version may perform better.

    SELECT ml.ID, ml.Cat, ml.Status

    FROM #MasterList ml

    WHERE NOT EXISTS (

    SELECT 1

    FROM #ListX lx

    WHERE ml.ID = lx.ID

    AND ml.Cat...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Performance issue

    esayasas (10/26/2016)


    What caused performance issue in SQL server?

    This thread is over seven years old, and the original poster hasn't logged in in almost seven years. At this point, it...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Windows Function

    Jeff Moden (10/26/2016)


    drew.allen (10/26/2016)


    Jeff Moden (10/25/2016)


    As a bit of a sidebar, it would have been nice if they had it default to a ROWS specification because it's faster than the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Windows Function

    Jeff Moden (10/25/2016)


    As a bit of a sidebar, it would have been nice if they had it default to a ROWS specification because it's faster than the RANGE specification.

    The reason...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,206 through 2,220 (of 4,085 total)