Forum Replies Created

Viewing 15 posts - 841 through 855 (of 1,473 total)

  • RE: Expressions based on data in the SELECT statement

    jeanangeo (12/27/2008)


    I'm fairly sure I will look back at it in a few years and see a million areas where I could improve the performance but it's out the...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    After some tests, ROW_NUMBER is still slow. I ran both queries on a real table and came up with 76% of the cost vs 24% of the cost when...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Funky happenings with Data Export Wizard

    MrBaseball34 (12/26/2008)


    Anything else Mr. Holmes?

    I really don't see any reason to be rude to someone who is attempting to help you, even if their suggestions in this particular case don't...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    Jack Corbett (12/26/2008)


    Garadin (12/26/2008)


    With the way that derived table is written, if you have more than 1 appointment that has the MAX(date), you will get multiple returns.

    Seth,

    The way I...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    Just to tie up the loose ends, this solution should be correct, and handle all situations.

    ;WITH MA( Apprentice_id, Agreement_ID, [Start_Date], RN )

    AS

    (SELECTApprentice_ID,

    Agreement_ID,

    [Start_Date],

    ROW_NUMBER() OVER (PARTITION BY Apprentice_ID ORDER BY [Start_Date] DESC)...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    Not a problem, Jude, glad we could help.

    I did figure out the issue with mine though, which is only an issue with multiple appointmentID's being the same. So, the...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    A few things

    1. To turn on actual execution plan, go to the Query option in the menu and select 'Include actual execution plan.'

    Alternatively, hit CTRL + M.

    2....

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    Q-Girl (12/26/2008)


    Thanks Seth, that works too. Is there a performance benefit to doing it your way over Jack's? Just so you know, the code will be a sub-query inside of...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    :hehe: Mornin Jack :hehe:

    I had an almost identical post typed out, then decided to try to get used to the new 2005 stuff that I always ignore. ...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Aggregate function

    To know how to handle it, we need to know what agreement_id you want.

    Do you want the start date of each? Add it to the group by.

    Do you...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: User-defined Function with Dynamically-build Query

    In a situation like this, I'd make a table like this instead:

    Table:CodeGroups

    CodeID

    GroupID

    IsExcluded

    Store a groupID for every codeID. Then, you can write your queries just by linking through this table....

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: After INSERT/UPDATE Trigger - Getting old values?

    I've never liked using JOIN's in delete statements, but I think you'd have to do it like this:

    CREATE TRIGGER [t_ptSchedule_TO_ptAppointmentsDELETE]

    ON [dbo].[ptSchedule]

    AFTER...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Get Missing Data with Tally Table

    Greg Snidow (12/24/2008)


    Jeff, I lost quite a few brain cells on this one, as it was just a bit over my head, and would be interested to see your...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: After INSERT/UPDATE Trigger - Getting old values?

    MrBaseball34 (12/24/2008)


    I didn't see where you deleted the old ptAppoinment record(s)

    To expand upon this (Jack is right that you don't need to delete).

    What you were doing in your last trigger...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: After INSERT/UPDATE Trigger - Getting old values?

    Yeah, I probably overuse left joins in situations like that. But he does allow NULL's (I still have a copy of that tabe definition from a past problem) in...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 841 through 855 (of 1,473 total)