Forum Replies Created

Viewing 15 posts - 586 through 600 (of 1,419 total)

  • Reply To: How show only first friday of every month

    Fwiw in 2021.  In the FROM clause use dbo.fnTally and CROSS APPLY (both twice) to hierarchically generate the first 7 days of each month.  Then in the WHERE clause filter...

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

  • Reply To: Get value of rows based on condition

    It's a lot going on.  The query splits the rows into "gap and island" groupings labelled 'grp'. Within each grouping the CTE 'top_c_cte' selects the largest CA value when Stat='C'. ...

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

  • Reply To: Issue with the SUM function

    It's not really a conclusive test.  Maybe you're missing a JOIN condition on location?  Is there a column in the SCPOMGR.DMDUNIT table which correlates to the 'LOC' column in the...

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

  • Reply To: Issue with the SUM function

    Maybe the INNER JOIN between SCPOMGR.FCSTPERFSTATIC AS F and SCPOMGR.DMDUNIT AS D on the 'DMDUNIT' column could be causing row expansion.  Would you expect this query to return zero rows?

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

  • Reply To: Please delete

    Vielleicht sowas

    with upd_cte(SUM_KBABenoetigteZeit, pm_extended_id) as (
    select sum(TCompl.usr_KBABenoetigteZeit), PMProc.pm_extended_id
    from rm_task_completion TCompl
    ...

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

  • Reply To: Are the posted questions getting worse?

    Again due to gaslighting on the other major technical Q&A forum I'm making pointless public statements

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

  • Reply To: Merge Conflicts with SQL Server Database Project

    For independent groups to modify the same set of objects and end up with code which combines the best elements of each somehow the merge conflicts must be dealt with,...

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

  • Reply To: Merge Conflicts with SQL Server Database Project

    After each merge make the remaining teams (with unmerged code) pull from the master (or the newer, more pc, 'main') branch.  The team with the least seniority makes the last...

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

  • Reply To: Invalid length parameter passed to the LEFT or SUBSTRING function.

    You could try PATINDEX twice to trim off any non 0-9 or A-z character.  It works with any number of *'s, leading/trailing spaces, etc

    select calc.*, substring(ucl.PROCEDURE_COMMENT,
    ...

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

  • Reply To: Perpetual Total - calculate difference between first and last value

    Suppose an offset day variable '@day_offset' is declared and then subtracted from GETDATE().  To get a daily report you could CAST the 'datetime' column into 'date' using CROSS APPLY (VALUES...

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

  • Reply To: Perpetual Total - calculate difference between first and last value

    The function dbo.GetDateCDT(GETDATE())) returns the 'Central Standard Time' (which adjusts for DST afaik) as date?  These lines are equivalent?

    -- returns Central Time truncated to date?
    select dateadd(day, datediff(day,...

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

  • Reply To: WHILE LOOP THAT LOOPS BASED ON AN ID

    It appears you're attempting to create "running totals" using the LAG function (which doesn't work).  You could maybe try SUM(...) OVER instead

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

  • Reply To: how to get quantity from yesterday 6pm till today 6pm

    Thanks for the code Scott.  I was messing around with the GETDATE function and +/-# parameter and how it worked wasn't totally clear to me.  I looked and didn't find...

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

  • Reply To: How to calculate the outcome based on multiple records for same Customer

    Well, more could be said about all of this.  I'm sticking by what I wrote tho.  Phil Factor article aside, in this particular question it seems reasonable to infer the...

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

  • Reply To: how to get quantity from yesterday 6pm till today 6pm

    uahmed90 wrote:

    Thank you for this response. It does work, but it's not what I need, because I need to compare with historical data, so I can't use getdata() in this...

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

Viewing 15 posts - 586 through 600 (of 1,419 total)