Forum Replies Created

Viewing 15 posts - 2,521 through 2,535 (of 4,085 total)

  • RE: How do I add a constraint to a column

    CELKO (7/21/2016)


    The bit and varying bit datatypes were deprecated in SQL: 2003 for good reasons. You can read some of this: https://www.simple-talk.com/sql/t-sql-programming/bit-of-a-problem/.

    Yes, but the SQL standards also have a BOOLEAN...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Comma separated

    Sean Lange (7/21/2016)


    drew.allen (7/21/2016)


    Get rid of the ISNULL altogether. FOR XML automatically discards null expressions unless the XSINIL directive is specified.

    SELECT DISTINCT STUFF(

    (SELECT ', ' + t2.Name

    FROM #Temp t2

    where...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Comma separated

    Get rid of the ISNULL altogether. FOR XML automatically discards null expressions unless the XSINIL directive is specified.

    SELECT DISTINCT STUFF(

    (SELECT ', ' + t2.Name

    FROM #Temp t2

    where t1.ID = t2.ID...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL query to display the count of combinations

    It's not clear how these results derive from your sample data: specifically, it's not clear why there are two rows for ER instead of 1, and it's not clear where...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Junk Dimension Design

    kewlguy13 (7/15/2016)


    Thanks Drew for the comments!

    If I had to design the Junk dimension with these values, what do you suggest.

    What would be Junk Dimension structure?

    Logic: I was thinking about CROSS...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Junk Dimension Design

    kewlguy13 (7/15/2016)


    Thanks Guys for the quick response!

    Looking at the target table structure, I could see that Cross Join doesn't fit. That's where I was confused.

    I will try with the EAV...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Assistance with CROSS APPLY with multiple tables

    Jabba1963 (7/15/2016)


    My problem in trying to apply (excuse pun !!) the CROSS APPLY approach from details in the article using one table - where I have many... basically its confusing...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Junk Dimension Design

    Your design is for an EAV table, not a junk dimension. A junk dimension is derived from the Cartesian product of your attributes so it would look more like

    JunkID

    SubscriptionStatus

    CustomerStatus

    PaymentDesc

    Document

    CaseType

    TransportedTo

    Obviously,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Compare multiple rows in same column

    I found a solution that seems to perform very well given certain pre-conditions.

  • There must be an index on Person/Comp or Person that includes Comp.
  • There must be fewer than 31 (or...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: aggregate function in subquery

    You can place your CASE expression in a CTE, derived table, or CROSS/OUTER APPLY and then do the SUM in the main query.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: count(null)

    Because you haven't specified a data type for the value NULL, and it can't figure it out from the value itself, so it assigns a NULL data type. It's...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Combine rows into one row with line break by querying with XML

    This is a presentation issue and should be left to the presentation layer.

    I am not seeing any strange characters when I run it. XML will entitize CHAR(13) (
), so...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how to find number of days between successive visists?

    cad.delworth (7/12/2016)


    drew.allen (7/11/2016)


    The reason that you were getting bad results is that your "dates" aren't really dates. They're strings, so they sort alphabetically.

    The OP didn't specify the data type...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Multiple joins to same table in view

    kobi.burkis (7/12/2016)


    Hi

    Thank you drew.allen for a quick response.

    I don't have an aggregate function to apply on the table for pivoting.

    You actually do. If you can guarantee a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Multiple joins to same table in view

    It sounds like this would help: Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url].

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Viewing 15 posts - 2,521 through 2,535 (of 4,085 total)