Forum Replies Created

Viewing 15 posts - 301 through 315 (of 1,413 total)

  • Reply To: Changing a UDF to a SET BASED QUERY

    It not a fully asked question imo.  It's a good one tho.  Hopefully some of that medication was prescribed.  You're looking for more efficient code.  It comes down to demonstrating...

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

  • Reply To: Where clause filter view before dense rank

    Jeff Moden wrote:

    Do you have a good example of an INSTEAD OF trigger for use with UPDATEs?  I've not seen a good one yet.

    It hasn't been necessary for my work so...

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

  • Reply To: Where clause filter view before dense rank

    Jeff Moden wrote:

    Except for the occasional Indexed View, this is one of the many reasons why I hate views.

    Ha my exception is for VIEWS with INSTEAD OF triggers

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

  • Reply To: Where clause filter view before dense rank

    Having performance issues while filtering a view is not uncommon.   Is the view indexed?  How much latitude is there for making changes?

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

  • Reply To: Where clause filter view before dense rank

    Still works

    select *
    from drview
    where field2 = 'x';

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

  • Reply To: Where clause filter view before dense rank

    Works.  Not sure what the issue is

    drop view if exists drview;
    go
    create view drview
    AS
    with cte as (
    select *
    from (values ('x', 'x'), ('x', 'x'), ('x',...

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

  • Reply To: Are the posted questions getting worse?

    Steve Jones - SSC Editor wrote:

    Happy New Year, everyone, and welcome to 2023!

    HNY SSC!  Thank you Steve for being a great host.  All the things 😉

    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:

    I could be wrong but that looks like it will do a full scan of the table for each grouping of rows.  Why not just do a single pass...

    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?

    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

Viewing 15 posts - 301 through 315 (of 1,413 total)