Forum Replies Created

Viewing 15 posts - 1,876 through 1,890 (of 3,957 total)

  • RE: Performing strange conditional COUNT

    ChrisM@Work (3/7/2013)


    This is called "Islands and Gaps". An island is a set of rows where the dates are consecutive, bounded by rows with non-consecutive dates. Jeff Moden has a great...

  • RE: Cursor replacement help

    Without knowing a little more about what exactly your functions return, this is just a shot in the dark:

    INSERT INTO @TEMP_EXPORT

    SELECT *

    FROM [dbo].[#TSC_ExportedColumnIds] a

    CROSS APPLY [dbo].[udf_TSC_qry_ExportBlockColumnParam1](@COLUMN_ID) b

    WHERE a.ColumnType...

  • RE: Are the posted questions getting worse?

    Lynn Pettis (3/6/2013)


    Really?? You have to be kidding.

    I'm tempted to violate my mantra and post a script that dumps all table names into a temp table and then CURSORs through...

  • RE: Are the posted questions getting worse?

    Lynn Pettis (3/6/2013)


    Several years ago my oldest daughter's JV soccer coach once confieded "I knew we were in trouble when half the team asked what was offsides?"

    Well, I've just seen...

  • RE: Really confused newbie - Perhaps a Temp Table query?

    Lynn Pettis (3/5/2013)


    dwain.c (3/5/2013)


    Lynn Pettis (3/5/2013)


    You know Dwain, now if we could just get you to use the semicolon as a terminator instead of a begininator! 😛

    Lynn - I'm...

  • RE: Really confused newbie - Perhaps a Temp Table query?

    Lynn Pettis (3/5/2013)


    You know Dwain, now if we could just get you to use the semicolon as a terminator instead of a begininator! 😛

    Lynn - I'm 100% with you...

  • RE: How to report period wise data ?

    Greg Snidow (3/5/2013)


    Well, Dwain, I was about to suggest the data should be stored with some sort of identifying element as to indicate whether or not the date indicates a...

  • RE: Really confused newbie - Perhaps a Temp Table query?

    Steven Willis (3/5/2013)


    Another old habit to break if you are using SQL2008 or greater is to avoid GROUP BY when all you really need is an aggregated column value.

    SELECT

    ...

  • RE: How to report period wise data ?

    You can use the staggered row number approach to get this:

    CREATE TABLE #empleaves(

    [empid] [int] NULL,

    [leavedate] [date] NULL

    ) ON [PRIMARY]

    GO

    INSERT #empleaves ([empid], [leavedate]) VALUES (1, CAST(0xCE360B00 AS Date))

    INSERT #empleaves...

  • RE: 6 places after decimal without rounding

    The ghostly apparition of the third parameter to ROUND makes its spooky appearance. :w00t:

    So here's various solutions except for Sergiy's showing they all work and timing results for 2 (my...

  • RE: 6 places after decimal without rounding

    You can try this:

    CREATE TABLE #Analysis

    (

    ID INT IDENTITY,

    Margin [numeric](21, 6) NULL,

    Gallons INT,

    Freight [numeric](21, 6) NULL,

    AccMargin [numeric](21, 6) NULL)

    INSERT INTO #Analysis ( Margin,Gallons,Freight)

    SELECT 0.050220,5022,-30.180000

    INSERT INTO #Analysis ( Margin,Gallons,Freight)

    SELECT 0.050220,-5022,318.260000

    UPDATE #Analysis

    SET AccMargin...

  • RE: More help wit Sum, Pivot and so on...

    tota00 (3/4/2013)


    This is fine. I have the total drop rate however I am also looking for the average drop rate per country as well as the average drop rate for...

  • RE: Select full month number (with 0)

    I for one offer you kudos for your affinity for speed Jeff.

    I formally confess that I tried for awhile yesterday to come up with something faster to no avail. ...

  • RE: need to return the last value

    If you can update it through the CTE (your option 2) it might be better. It may be necessary to reverse the order of the JOINed tables, i.e., make...

  • RE: Custom order in SELECT

    Try it like this:

    DECLARE @test1 TABLE (letter varchar(1))

    INSERT INTO @test1(letter) VALUES('a')

    INSERT INTO @test1(letter) VALUES('b')

    INSERT INTO @test1(letter) VALUES('c')

    INSERT INTO @test1(letter) VALUES('d')

    INSERT INTO @test1(letter) VALUES('a')

    INSERT INTO @test1(letter) VALUES('a')

    INSERT INTO @test1(letter) VALUES('d')

    INSERT INTO...

Viewing 15 posts - 1,876 through 1,890 (of 3,957 total)