Forum Replies Created

Viewing 15 posts - 211 through 225 (of 244 total)

  • RE: Dynamic where clause

    this will work as well

    select col1,col2

    from Table

    where col3 = case when @VarName = 'red' then @VarName else col3 end

    and col3 <> case when @VarName = 'red' then '-1' else...

  • RE: Using DATEDIFF with Aggregations

    if u send the table schemas i can give it w proper syntax

    i did notice the count(distinct p.progId) had a typo in it. fixed below

    select u.id

    , count(distinct p.progId)

    from user...

  • RE: Using DATEDIFF with Aggregations

    i think this will work however hard to test w/o actual tables and data

    select u.id

    , count(distinct piprogId)

    from user u

    join (

    select userid

    , max(datecreated) mxProjDate

    from project

    group by userid

    ) mx

    on u.id = mx.userId

    join...

  • RE: Cursors. Are the really that evil?

    -----------------------------------------------------------------------------------------------

    --PiMane yesterdy 10:49pm

    --cursors are a necessary evil... some tasks just need cursors and there's no way of replacing them

    ------------------------------------------------------------------------------------------------

    The only explanation why I think someone would feel that was is...

  • RE: Cursors. Are the really that evil?

    ----------------------------------------------------------------------------

    --Lynn and I are agreeing with you. john scott miller is the one making odd statements about hair, good guys, and disagreeing with Lynn that cursors have any use at...

  • RE: Cursors. Are the really that evil?

    -----------------------------------------------------------------------------------------------

    If you were writing a proc that was supposed to run a log backup command on each active database in Full recovery model, which is a situation where you have...

  • RE: Cursors. Are the really that evil?

    you would hate me then. one of the first things i do is redesign all proc away from cursors. Perhaps i am you arch nemesis and u mine.

    The question...

  • RE: Helo with Update

    cool. And for future reference you should get in the habit of using the ON when joining.

  • RE: Cursors. Are the really that evil?

    You cant exclude them if for instance it is based on time and the threshold that will make the particular constraint true will only hold true while the actual loop...

  • RE: Cursors. Are the really that evil?

    I must preface this post w/ the fact that I hate cursors. The simple fact I must allocate and deallocate something drives me batty and if you have embedded transactions...

  • RE: Table Update Help Needed

    when u say "So record number 8 and 9 would have another random number in the Group column" are u saying those two will have the same random number?

  • RE: Help With getting a count query to work

    The funny thing is after i submitted it i actually had to do the exact same thing for work and tried the same approach. Once i started testing the results...

  • RE: SELECT and REPLACE query

    yes that will do it.

  • RE: Update HELP

    Did you actually try that, John? It returns exactly the same phone number for all rows.

    --Jeff Moden

    -------------------------------------------------------------------------------------

    No i did not and that is why i am an idiot. Was...

  • RE: SELECT and REPLACE query

    Hi guys, thanks for the suggestions!

    Would something as simple as this work?

    UPDATE myTable

    SET linkURL = REPLACE(linkURL, 'oldIP', 'newIP')

    ----------------------------------------------------------------------------------------

    --not really because that would replace anywhere in the linkurl that had the...

Viewing 15 posts - 211 through 225 (of 244 total)