Forum Replies Created

Viewing 15 posts - 3,451 through 3,465 (of 4,085 total)

  • RE: SQL Code Help

    CELKO (12/5/2011)


    Your approach to SQL is fundamentally wrong.

    Your approach to SQL training is fundamentally wrong. Without specifics on what you think is fundamentally wrong, why you think it is...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Code Help

    ChrisM@Work (12/5/2011)


    You might get one or two ideas from the following. It's proving very usable for data cleansing, which is similar to your scenario - you want to identify a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Code Help

    aarionsql (12/5/2011)


    HI Drew,

    can I have a join in a CASE statement?

    No, but you can have a correlated subquery, a (NOT) IN with a subquery, or a (NOT) EXISTS with...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Code Help

    aarionsql (12/5/2011)


    Hi Jim,

    Many thanks for your help. I should have mentioned I have gone down the route of CASE statements .. but there are far too many columns to look...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Code Help

    Jim-720070 (12/5/2011)


    Hi,

    How many fields do you need to look at? If there aren't too many you could use a CASE statement, given you work the logic out correctly:

    SELECTEmp_No,

    HR_ID,

    CASE

    WHEN LEN(Emp_No)...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Code Help

    aarionsql (12/5/2011)


    Hi Lowell,

    Many thanks for the code .. I am looking to loop as I will have a number of such columns and I will want to concatenate the error...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Aggregate Issue

    It also helps to include expected results based on your sample data and what you have already tried. This looks fairly straightforward to me, so I must be misunderstanding...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: t sql funny

    CELKO (12/1/2011)


    I am amazed at the dialect you got into one query! Here is how to actually write this in T-SQL using real ANSI SQL instead.

    In case you hadn't noticed,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Converting XML Column

    kev43barrie (12/1/2011)


    Ended up creating a function and calling the function in my select statement. Wasn't wanting to do that, but seems to be the best way.

    Then why create one?...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query Help

    MyDoggieJessie (11/30/2011)


    What is best to rewrite the below query instead of using temp table or cursors

    Do you have specific concerns with using the temp tables? Or are you seeing...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: CASE HELP

    It looks like you're going to need to use an aggregate function with windowing. The simplest case would be

    CASE WHEN MAX(Status_ID) OVER( PARTITION BY Order_Number ) > 40 THEN...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: (Re)Sorting records

    The Dixie Flatline (11/29/2011)


    A good carry-away lesson from this is that set-based solutions are possible, even easy, whenever you can define the sets properly. The failed solution...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: (Re)Sorting records

    I've been thinking about this, but hadn't come up with a workable solution until now.

    WITH Remaining_Prods AS (

    SELECT p.ID

    ,p.[Name]

    ,Row_Number() OVER ( ORDER BY p.Sort ) AS Seq

    FROM Prods AS p

    LEFT...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: all OutputList nodes from different parent nodes?

    Use the '//' that you want to find all occurrences. Something like p.query_plan.nodes('//sp:RelOp/sp:OutputList/sp:ColumnReference')

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: grouping by regions except in one case

    mgoldade (11/28/2011)


    However, the desire is that online courses print in ALL groupings AND as their own section for the students who only take courses online.

    Remember that CASE is a "function"...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,451 through 3,465 (of 4,085 total)