Forum Replies Created

Viewing 15 posts - 46 through 60 (of 1,413 total)

  • Reply To: how to calculate an average only if a minimum number of records exist?

    Where's your sample data?  A calendar table determines the workdays?  This is asking a bit.  Using AVG OVER can only accept literal numbers in the RANGE PRECEDING and afaik it...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql script replace and rearrange numbers

    drew.allen wrote:

    You can combine the two deletes into a single delete.

    WITH Combine_Colors AS
    (
    SELECT *, ROW_NUMBER() OVER(PARTITION BY p.Airplane ORDER BY p.[Priority]) AS rn
    FROM #Priority AS p
    WHERE p.Color...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql script replace and rearrange numbers

    Sorry, sorry my apologies.  I didn't catch the inconsistency.  The green arrows in the image you posted only point up!  Afaik that's the part I missed.  Once there's an accepted...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql script replace and rearrange numbers

    Instead of 3 statements: "UPDATE Color, DELETE Color='White', UPDATE Priority", these 2 statements seem equivalent and simpler: "DELETE Color='White', UPDATE Color, Priority"

    NOTE: As per the post below the code...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql script replace and rearrange numbers

    Happy Holidays to SSC!  Nicely done Phil.  Hmm... an issue which could potentially screw up the solution is the lack of constraint(s) on the input table.  Why are all of...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: How to speed up this query?

    That's a nice looking query Ken.  The OP's query used "SELECT ... INTO #TEMP1" which could be a bottleneck to a larger process imo.  Of course, it's not possible to...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Group records during capture

    Bruin wrote:

    How could I last 15 minutes of activity pulling the unique record per minute

    Scroll up a few posts and see Ken McKelvey's reply.  Once t_stamp has been converted to...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: The Paradox of NOLOCK: How Dirty Reads Can Sometimes Be Cleaner

    Well, I admit I've never used NOLOCK in a query.  There hasn't been any project where NOLOCK is/was clearly required.  The article doesn't actually put forward any performance metrics or...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Group records during capture

    Bruin wrote:

    That would be true if working with a Normal date, but the Unix-Timestamp stored in T_stamp needs converted I'm thinking. 

    Yep, t_stamp stored as BIGINT could be converted to DATETIME2(3). ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: The Paradox of NOLOCK: How Dirty Reads Can Sometimes Be Cleaner

    Or the paradox is an enigma wrapped in a riddle.  The article is based on a musing which is factually unconfirmed.  Or maybe I missed the convincing part(s)

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Trigger After Update to Update the Updated Table

    Jeff Moden wrote:

    <b>...</b> the correct criteria to update only those rows that actually have a "1" in the Resolved Column of the INSERTED table.

    Ah ok, this is more correct.  My...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Trigger After Update to Update the Updated Table

    Dennis Jensen wrote:

    Okay I can easily see how to update a table field after an Insert but do I use the system Inserted when creating a trigger to update a field...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: identify consecutive records greater than 1

    with rn_cte as (
    select l.*, v.gt_one,
    row_number() over (partition by Number...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: identify consecutive records greater than 1

    The queries so far don't identify the ranges of consecutive "greater than one" rows.  This query uses two ROW_NUMBER functions which both count up across PARTITION BY Number.  To reset...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Group Delete

    Is CostKey unique in the CostKeyDeletes table?  If so then making it the CLUSTERED key would be preferable.  To log the process you could add an OUTPUT clause to the...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

Viewing 15 posts - 46 through 60 (of 1,413 total)