Forum Replies Created

Viewing 15 posts - 1,456 through 1,470 (of 1,957 total)

  • RE: Set based trigger with decision to update or insert

    Of course, you might also want to only do this if fielda has changed...

    add this to the where clause about fielda not being null :

    ... and not exists ( select...

  • RE: Set based trigger with decision to update or insert

    You need to translate your IFs into WHERE clauses...

    update table1

    set col1 = (select col1_source from inserted where hashFields = table1.unique_id)

    where unique_id in (select hashFields from inserted where fielda is not...

  • RE: Testing 2k code validity in 2k5 environment

    No, compatibility mode won't help you there.

    For instance, aside from being able to use non-2000 data types, you can use CTEs, CROSS APPLY etc

    And even behaviours that are supposed...

  • RE: Grouping and crosstab like behaviour.... hairy query

    Try this:

    select Factor,min(PartNumber) as PartFrom,max(PartNumber) as PartTo

    from Factors2Process

    group BY Factor,stuff(PartNumber,7,5,'')

    order by Factor,PartFrom

    And by the way - there is no order by on the query in your cursor definition...you should...

  • RE: Need help identifying query

    Lowell (2/18/2011)


    Mr Magoo I'd love to hear the back story on this...might be very educational for us....

    what happened that made you start thinking something was flooding the server...after looking at...

  • RE: Need help identifying query

    Roy, you were spot on..I did a bit of research, found out about the idle timeout testing that C3P0 does and that led me to the configuration file that contained...

  • RE: Need some help with query taking forever

    In this case, I am using CROSS APPLY just as a way of creating placeholders for the calculations.

    It just makes the SELECT cleaner - but should not have any other...

  • RE: Need help identifying query

    Roy Ernest (2/18/2011)


    I think it was created to test the connection pooling of C3P0 which is used by JDBC and nHybernate.

    Great, thanks very much Roy, that has given me enough...

  • RE: Need some help with query taking forever

    I think this is what I meant to write just now...

    SELECT

    sli.itemid ,

    sli.title,

    qtysold = SUM(qtys.qtysold),

    change = SUM(qtys.qtysold - qtys.qtysoldprevious)

    FROM

    sale_line_item AS sli

    JOIN

    transactions AS trn

    ON

    trn.txid=sli.txid

    CROSS APPLY

    (

    SELECT

    qtysold...

  • RE: Need some help with query taking forever

    I agree with Craig, but also - why not try doing it all in one SELECT...?

    edit: sorry my bad code removed

  • RE: Query Performance -Troubleshooting

    GilaMonster (2/17/2011)


    mister.magoo (2/17/2011)


    I have noticed in the past that COUNT(*) does not always force a full count of all rows

    It does. It reads the leaf level of the smallest index...

  • RE: why the avatar picture you use

    Ray K (2/17/2011)


    Don't have one, only because I'm lazy. Haven't gotten around to it yet!

    How about this one

  • RE: Query Performance -Troubleshooting

    Ok, I have had a quick check and can't find any noticable difference between them now, so maybe I just remembered something wrong....never mind - no harm done 😛

    edit: checking...

  • RE: Query Performance -Troubleshooting

    I have noticed in the past that COUNT(*) does not always force a full count of all rows

    I remember pushing the FIZZBUZZ problem to a trillion rows and used count...

  • RE: Query Performance -Troubleshooting

    What happens if you try this on both servers (post results back)?

    set statistics io on;

    set statistics time on;

    go

    set showplan_text on;

    go

    select count_big(all column_name)

    from your_table

    go

    set showplan_text off;

    go

    set statistics time off;

    set statistics io...

Viewing 15 posts - 1,456 through 1,470 (of 1,957 total)