Forum Replies Created

Viewing 15 posts - 3,196 through 3,210 (of 4,085 total)

  • RE: Result to display in Tex Mode.

    SSMS is a UI built to work with T-SQL. It is not part of T-SQL. Text mode and grid mode are functions of the UI itself, not native...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Find second occurence of a word

    CHARINDEX() has an option parameter (start_location) that can be used to skip the first occurence of the specified string. If you want an example, you'll have to provide more...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Insert data into single table from multiple tables

    Please don't hijack old threads. If you have a new question, start a new thread.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    polkadot (4/20/2012)


    actually, I thought he was taking the first date of one status (top Active) and the first date of the second status (because of reverse ordering) when I first...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    polkadot (4/20/2012)


    Dwains does pretty much exactly what needs to be done even with the additional business rules, with the exception that it errors in two places:

    The problem with Dwain's code...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    polkadot (4/20/2012)


    Drew,

    please explain how 'Days' is introduced. Since you and Dwain are both using DATEDIFF to extract

    day portion of the datetime, I would have expected your CASE statements...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: The DELETE statement conflicted with the REFERENCE constraint "". The conflict occurred in database

    There is a third option. Update the rows in Table2 so that the constraint will still be valid after the delete. You can either update that column to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: insert data into a table from another table, while sorting according to a field.

    Check out Jeff Moden's article Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    polkadot (4/20/2012)


    Drew, I appreciate your help. Your query does almost everythinig but the numbers appear to represent the number of days a given ticket is in any status and...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: insert data into a table from another table, while sorting according to a field.

    abs1337 (4/20/2012)


    I tried playing around with something like this:

    and I get this error "The select list for the INSERT statement contains fewer items than the insert list. The number of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    Sorry about the error in my code. I forgot to copy the entire code.

    Here is an update with changes to provide an average rather than a count. The...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Return items not modified in "X" days?

    You're looking for the HAVING clause.

    SELECT SerialNum, MAX(UsedDate) AS LastUsedDate

    FROM YourTable

    GROUP BY SerialNum

    HAVING MAX(UsedDate) < DATEADD(YEAR, -1, GETDATE())

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    dwain.c (4/18/2012)


    ,ROW_NUMBER() OVER (PARTITION BY Case_ID, PPL_Area, Review_Status

    ORDER BY Case_ID, PPL_Area, Review_Status, Revision DESC) As rk

    I only quoted the relevant section of the code.

    By definition, the partitioning fields are...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    I'm getting different results from Dwain for one of the records. He has WA_Traffic in a Proposed Status for <30 days, but I'm getting 30-60 days.

    Here is how I...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a very COMPLEX aggregation query

    polkadot (4/19/2012)


    drew. will you please elaborate the 'certain circumstances'?

    I shall venture to disagree with that statement under certain circumstances.

    That was a quote of Dwain.C. He mentions some of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,196 through 3,210 (of 4,085 total)