Forum Replies Created

Viewing 15 posts - 6,616 through 6,630 (of 8,731 total)

  • RE: Order by tweak

    So based on that sample data, what's your expected output?

    Does this help?

    WITH CTE AS(

    select *, DENSE_RANK() OVER(PARTITION BY Segment ORDER BY deptno) rankno

    from #check1

    )

    UPDATE CTE SET

    SetColumn = rankno

    SELECT *

    FROM #check1...

  • RE: Order by tweak

    You didn't follow the advice correctly.

    You might need to use a ranking function to update your table but without ddl, sample data and expected results I can't be sure about...

  • RE: A Questionable Trigger

    Sean Lange (4/2/2014)


    Luis Cazares (4/2/2014)


    I believe that there's an error in the logic of the trigger since there's no change in the data. If the information hasn't changed, then the...

  • RE: A Questionable Trigger

    I believe that there's an error in the logic of the trigger since there's no change in the data. If the information hasn't changed, then the datechanged value shouldn't change...

  • RE: How to update the year an employee has been in a specific TITLE

    anil.varghese (4/2/2014) (From PM)


    Luis

    Thanks for your assistance. I believe I do understand what you are doing. This is new to me, so if there is some documentation on what you...

  • RE: Invalid Sql returns all rows

    If you used 2-part names for your columns, it should become clear.

    select *

    from #Table1 t1

    where t1.mykey in (select t1.mykey from #BadLookup bl)

    It might look weird that the subquery is...

  • RE: clicking 'Active THreads' link gives differnet results between Google Chrome and IE

    It seems that "Active Threads" will show you the threads with a post since the last time you closed your browser. If it doesn't show enough threads, you could use...

  • RE: SQL Transpose / Pivot - Help

    I'm glad that you could get it done and it's even better to know that you're aware of this terrible design.

    Good luck with this project (you'll need it).

  • RE: How to update the year an employee has been in a specific TITLE

    anil.varghese (4/2/2014)


    Thanks, this worked great. As to a response to a previous question, A promotion is identified by a change in title and the year of that change.

    That's great!...

  • RE: Execution Plan what to look for

    You shouldn't look at the subtree cost, that's an estimated value not a real one.

    If you have an index on enddate, you might see a change from an index seek...

  • RE: Are the posted questions getting worse?

    GilaMonster (4/2/2014)


    Ok......

    Guideline for python code:

    "Explicit is better than implicit"

    I can agree with that, it's something I argue for when teaching T-SQL. Be explicit.

    Then, from the style guide for python:

    Bad form:

    if...

  • RE: Are cursors hard on servers?

    RonKyle (4/2/2014)


    there are tasks which do justify the use of cursors

    I'm sure this is true, but I haven't run into one yet. Once I thought I had, but...

  • RE: Get max row based on the combination of 2 columns

    Something like this?

    WITH CTE AS(

    SELECT *,

    ROW_NUMBER() OVER( PARTITION BY OrderID, ItemType ORDER BY OrderDate DESC, OrderTime DESC) rn

    FROM @MySampleOrders

    )

    SELECT *

    FROM CTE

    WHERE rn = 1

  • RE: How to update the year an employee has been in a specific TITLE

    You might be able to use the Quirky update[/url] or the LEAD/LAG functions available on 2012.

    However, I did this using an islands solution that might fit your problem.

    WITH Groups AS(

    SELECT...

  • RE: Are cursors hard on servers?

    I'm not sure that I agree with Eirikur about saying "it depends". I'm sure that cursors are always hard on servers, but some methods can be worse (e.g. triangular joins)...

Viewing 15 posts - 6,616 through 6,630 (of 8,731 total)