Forum Replies Created

Viewing 15 posts - 316 through 330 (of 1,419 total)

  • Reply To: Is there another way to solve this "group in 5 day spans" problem?

    One approach could be to use a WHILE loop to increment grp values based on row counts and the DATEDIFF interval

    Starting with Jeff's code:

    --=================================================================================================
    -- ...

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

  • Reply To: Is there another way to solve this "group in 5 day spans" problem?

    Jeff Moden wrote:

    The fellow with the "Accepted" answer made the same mistake and worse because he used DENSE_RANK on the days.  Unfortunately for him, there were enough days in the original...

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

  • Reply To: Using SQL - Convert column to rows - not a straight forward pivot

    Before the pivot it needs to enumerate the rows partitioned within portfoliocode(s).  Once you have the 1's and 2's (if any) you could pivot using conditional aggregation, or the built-in...

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

  • Reply To: Upgrading SQL Server Central

    Steve Jones - SSC Editor wrote:

    I want to defer this process as long as possible. To me that means always aiming for the latest and greatest version. SQL Server releases roughly every 2-3 years,...

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

  • Reply To: NULLIF in SSIS?

    Not sure about SSIS specifically but in T-SQL the following seems to be equivalent afaik and unless it can be proven otherwise 🙂

    select case when '1900-01-01'='1900-01-01' then...

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

  • Reply To: Merge String into single string

    Imo this is a guessing puzzle unless there's more of an explanation.  What are the rules to apply here?  Why not remove all of the dashes '-' and then concatenate...

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

  • Reply To: average of percentage

    What's the new question?

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

  • Reply To: average of percentage

    By default SQL Server performs integer division on integers which means decimal remainders are truncated.  The DB Engine switches  to floating point math if the denominator of a fraction is...

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

  • Reply To: Why do Sql Server In operator behaves differently and return nothing?

    Sorry  not able to replicate the issue.  The OP code relies on implicit conversion between INT and NVARCHAR which generally works but is an error prone (and awful for the...

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

  • Reply To: Are the posted questions getting worse?

    TRIGGER_NESTLEVEL?  I usually try to persuade novices out of it.  Maybe the non-INSTEAD OF triggers could ask themselves: "Have I been executed at an inappropriate nest level?"

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

  • Reply To: should atemp table be used from looping even when single table is used in a loop

    The textbooks say writing your own loops in relational database code is something to be avoided.  Are you sure it's necessary to write loops?

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

  • Reply To: Are the posted questions getting worse?

    Jeff Moden wrote:

    SGAB, does any one have a decent example of an Instead Of Update trigger that will handle more than one bloody row at a time and also ONLY update...

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

  • Reply To: Get Date Monday Show results for weekend and then else 24 hours

    To generate sample data you could use a Tally table and calculate a datetime column.  This generates 400 rows and calculates a column 'sample_dt' which starts with the current...

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

  • Reply To: Split string

    Interesting and much appreciated.  Happy Thanksgiving!

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

  • Reply To: Split string

    If you load up one of the strings with a bunch of commas it causes an error afaik.  JSON doesn't care how many commas in a row.  A tiny point...

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

Viewing 15 posts - 316 through 330 (of 1,419 total)