Forum Replies Created

Viewing 15 posts - 2,491 through 2,505 (of 4,085 total)

  • RE: Finding related records within the same table

    Your rCTE should start with the original stakeholders, instead of starting with the stakeholder that you are interested in, because you only need to traverse the tree in one direction...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: remove duplicate values in a view , without affecting main tables

    Look up ROW_NUMBER, specifically Example B: Returning a subset of rows. You want to return the subset where the ROW_NUMBER equals 1. You just have to define the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Resources to entity tables relationship

    Boris Pazin (8/4/2016)


    drew.allen (8/4/2016)


    There is another approach, but it's a lot more complicated and I would need the information that the others have requested to make a reasonable attempt at...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Resources to entity tables relationship

    Have you considered using SEQUENCE instead of an IDENTITY? Sequences are similar to identities, but they're not tied to a specific table.

    There is another approach, but it's a lot...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with a PIVOT

    Luis Cazares (8/3/2016)


    drew.allen (8/3/2016)


    Luis Cazares (8/3/2016)


    pnr8uk (8/3/2016)


    What does the u in this line mean?

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with a PIVOT

    Luis Cazares (8/3/2016)


    pnr8uk (8/3/2016)


    What does the u in this line mean?

    (...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: nested or hierarchal sql query using FOR XML Path

    You have a main query and three subqueries. The subqueries can only access fields within their scope and the parent's scope. They cannot access fields/tables from the other...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: inefficient query

    And here is an option changing the last part to a NOT EXISTS. This also assumes that PolicyInsuredLocGK cannot be NULL.

    AND NOT EXISTS (

    SELECT 1

    FROM AIRGBS.vLCExtract AS lc2

    WHERE lc.AccountNum...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: inefficient query

    scottcabral (8/3/2016)


    i get this:

    Use of DISTINCT is not allowed with the OVER clause

    You can still use windowed functions, but it's a bit more complicated. I would start with something...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with a PIVOT

    You haven't supplied the expected output, but I suspect you are trying to transpose the data rather than pivot the data. You would need to unpivot followed by a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: In-Line TVF Split Function JOIN to Base Tables Optimization

    regan.wick (8/2/2016)


    Thx David

    I read the post you cited. This is the key line from it.

    "3.Use inline TVF when possible: In the demo, it’s unnecessary to use a multi-statement TVF....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: PLEASE HELP - Pivot just not working

    Part of the problem that you are having is that the IN clause of a PIVOT requires a set of quoted identifiers, but you are supplying expressions. When determining...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need Help with XML

    Jampandu (8/2/2016)


    /*

    -- Expected output

    <?xml version=”1” encoding=”utf-8”?>

    <Batch>

    BatchID=”1” Count=”999” Status=”Errors”

    <Doc>

    Type=”XXX” Code = “XXXX” Number=”xx111” Id=”9999”

    <Error>888</Error>

    <Address>Address1</Address>

    </Doc>

    </Batch>

    */

    Are you sure you don't want your output to look more like this (that is...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Add New Column with RowID

    Since you are on SQL 2012, have you considered using LEAD/LAG instead of doing a self-join?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Synonyms

    CREATE SYNONYM (Transact-SQL)


    Synonyms can be created for the following types of objects:

    Assembly (CLR) Stored Procedure

    Assembly (CLR) Table-valued Function

    Assembly (CLR) Scalar Function

    Assembly Aggregate (CLR) Aggregate Functions

    Replication-filter-procedure

    Extended Stored Procedure

    SQL Scalar Function

    SQL Table-valued...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,491 through 2,505 (of 4,085 total)