Forum Replies Created

Viewing 15 posts - 961 through 975 (of 1,473 total)

  • RE: Min Max Quartile

    Kelvin Phayre (12/9/2008)


    I put 1.5m rows into a table and then ran your query. I then stopped the query before it crashed the server.

    I then took a different tac. 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: How do I Pass a value into a with statement from my sql statement

    1. Remove the WHERE from your CTE.

    2. Add the line

    INNER JOIN TestStep T ON P.ProcessID= T.ProcessID

    to your final select

    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: Detail Records into Summary Format via Stored Procedure?

    Give this article a read.

    http://www.sqlservercentral.com/articles/T-SQL/63681/

    The X is the derived table alias, doesn't have anything to do with the GROUP BY.

    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: Min Max Quartile

    I think this will be more along the lines of what you're looking for to get all your products. Please note, that this may be very slow, but 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: Min Max Quartile

    Ok, I thought that might be what you were attempting, but 25% chunks seemed a bit large, so I wanted to verify ;). David's examples come out of 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: Min Max Quartile

    What are you trying to do with the TOP 25 Percent's?

    I'm not quite getting what you want returned here, can you provide your expected results based on that...

    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: Min Max Quartile

    Kelvin Phayre (12/9/2008)


    I have a table with thousands of sales history records. Some of the records have skewed data i.e products being sold for £250k or £0.00 (company fudges etc)....

    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: T-sq doubt

    Chris Morris (12/9/2008)


    You tell us. There are no mindreaders here.

    I knew you were going to say that.

    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: Inserting Default Values Using CASE Statement

    If the situation is really as simple as your example, you can always use an IF instead. (It's probably not, but I'll try the easy way out first).

    IF @Field1...

    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: Inserting Default Values Using CASE Statement

    CREATE PROCEDURE Test

    @Field1varchar(5) = 'foo'

    AS

    INSERT INTO MyTable (Field1)

    VALUES (@Field1)

    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: Handy Scripts to Find Dates and Weeks in SQL

    Bob Hovious (12/7/2008)


    The mighty Garadin is correct. My last couple of examples were step-by-step, each dependent on the last. You can of course nest 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: Handy Scripts to Find Dates and Weeks in SQL

    Bob Hovious (12/7/2008)


    -- adding/subtracting integers to datetime = adding/subtracting days

    set @dt = dateadd(mm,1,@dt)-1-- adds a month then subtracts a day

    select @dt as [Last Date of Subject Month]

    Note that this only...

    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: Look up a table fields, data type, etc.

    Jeff Moden (12/6/2008)


    I remember how I used to code SQL when I first started... one huge query for each batch project... it was actually worse than any cursor anyone...

    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: using ISNULL with string

    If you created a stored procedure, and your header looks like this:

    CREATE PROCEDURE Blah

    @firmname varchar(50)

    AS

    and not like

    CREATE PROCEDURE Blah

    @firmname varchar(50)...

    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: Create a temp field within a select statement ?

    Goldmine... ack. Some nasty memories of that one.

    Can you just add an identity column to the table and import that as well for uniqueness?

    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 - 961 through 975 (of 1,473 total)