Forum Replies Created

Viewing 15 posts - 1,216 through 1,230 (of 3,957 total)

  • RE: Determine time elapased by hour

    Another take (also not handling crossing midnight), with some sample data added.

    declare @t as table (ptr int identity, START time, ENDD time)

    insert into @t (START, ENDD)

    SELECT '09:30', '10:30' union all

    SELECT...

  • RE: Summing charges based on the record level NRV code

    I am neither a health care professional nor particularly healthy, but perhaps I can help. 😛

    J M-314995 (6/20/2007)


    Acct# Plan_Code Patient_type ...

  • RE: How to Get Selected row values?

    Looks like homework to me.

    Start by explaining why you want the first row with the StudentID you've highlighted.

    Then look up ROW_NUMBER() in MS Books on Line.

  • RE: accurate ticket times

    Note that SQL 2012 has a new analytical function (LAG) that makes short work of this.

    SELECT CSS_Service_Ticket_id

    ,Opened=MIN(Time_Stamp)

    ,Closed=MAX(Time_Stamp)

    ,Duration=SUM(Duration)

    FROM

    (

    SELECT CSS_Service_Ticket_id

    ...

  • RE: accurate ticket times

    Now that I've had some coffee, I think this is what I meant.

    SELECT CSS_Service_Ticket_id

    ,Time_Stamp, jh.New_Value

    INTO #Temp

    FROM #rsys_tables_temp ta

    INNER JOIN #journal_items_temp ji ON ji.Reference_Table = ta.Tables_Id

    INNER JOIN...

  • RE: Running Count

    mickyT (10/29/2013)


    dwain.c (10/29/2013)


    BTW. You can probably remove this from the Tally solution:

    , rnk=MIN(rnk)

    From the SELECT list of the inner query. I was using it for testing. It...

  • RE: Running Count

    BTW. You can probably remove this from the Tally solution:

    , rnk=MIN(rnk)

    From the SELECT list of the inner query. I was using it for testing. It might drop...

  • RE: Running Count

    mickyT (10/29/2013)


    And so far Dwains Tally solution looks like the winner based on the IO stats:-D

    So much for my guess. I was betting on #2 and a tie with...

  • RE: accurate ticket times

    Strike that. Not sure what I was thinking.

  • RE: Running Count

    A couple more alternate approaches:

    -- #1: Using a Tally table

    WITH Tally (n) AS

    (

    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL))

    FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) a(n)

    )

    SELECT...

  • RE: Performance of the SQL MERGE vs. INSERT/UPDATE

    ChrisM@home (10/29/2013)


    Thanks Dwain for another informative and well-written article. It wouldn't surprise me if the discussion provoked a significant rewrite with more use cases, based on posts so far.

    Thanks Chris....

  • RE: Performance of the SQL MERGE vs. INSERT/UPDATE

    It seems that there is quite a bit more variation than I thought. I have 2 machines available for testing:

    1. The Lenovo reported at the end of the article,...

  • RE: Performance of the SQL MERGE vs. INSERT/UPDATE

    Koen and sqlnaive - Thank you sirs for the feedback.

    Now on to rerunning my test harness with a couple of variations.

  • RE: Best Practices / Considerations

    One thing I'd look at is integration points.

    If application A is using data from any application sitting on server Y, perhaps its database is best stored on server Y.

  • RE: Need an update to cascade among columns but its setting all columns

    Why not avoid the UPDATE entirely by making [SellThrough1Hour], [SellThrough2Hour], etc. computed columns?

    You already have the CASE statements you'd need in those column definitions.

Viewing 15 posts - 1,216 through 1,230 (of 3,957 total)