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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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).

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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!...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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