Forum Replies Created

Viewing 15 posts - 31 through 45 (of 1,419 total)

  • Reply To: Is there a way for SP to know who called it?

    If there are alternate code paths which depend on the client then spare a thought for the optimizer. This pattern implies parameter sniffing imo.  To the extent there are separate...

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

  • Reply To: Work out closing balance using opening balance of prior month

    Ah yes, I see that now.  Thanks Jeff.  In my head I did check to make sure the dates within the partition were unique and then told myself "nothing to...

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

  • Reply To: Work out closing balance using opening balance of prior month

    Yes I agree pietlinden has the correct approach imo.  SUM OVER provides a running total without recursion

    select *, sum(OpenOpps+CreatedOpps+WonOpps+LostOpps) over (partition by Division order by [Date]) running_total
    from...

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

  • Reply To: SUM([value]) and highest record type

    DROP TABLE IF EXISTS #data_table;
    GO
    CREATE TABLE #data_table (
    Id INT PRIMARY KEY,
    Model INT,
    RecordType INT,
    ...

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

  • Reply To: Dependency Chain

    It took some testing to get the recursion working.  From the reference paths it's not clear how to proceed tho.  Maybe you're looking for the maximum level for each ProcedureName?

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

  • Reply To: Is there an ISERROR equivalent in SS?

    water490 wrote:

    How do I code "calc1 has error"?  The above code is part of a larger code where results results are passed up from sub-query to parent query so...

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

  • Reply To: New lightweight pure‑T‑SQL unit‑testing framework (T‑TEST) — feedback welcome

    Very nice.  The chess app is interesting too.  Could you explain the project structure of the chess app a little more?  There appears to be more than one chess engine

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

  • Reply To: Question on SQL Query with NOT condition

    "I am trying to pull the record with ID 198765 out from select query where first and last or full name does not exists."

    What seems to be intended is for...

    • This reply was modified 1 years, 3 months ago by Steve Collins.

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

  • Reply To: Migrating data from using ManagerId to HierarchyId

    There are examples on the internet of how to recursively assign HIERARCHYID.  A while ago on this forum:

    Using hierarchyID

    My reply in the SSC forum was based on this Stack...

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

  • Reply To: continuous membership

    "a continuous year without any gaps" might mean different things.  This assumes it to mean (any) 365 days in a row

    If the EXP_DATE is null does that mean the account...

    • This reply was modified 1 years, 3 months ago by Steve Collins.

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

  • Reply To: T-SQL Parent Child

    Hey there why so hasty?  If you'd fixed the script we might've seen some JM t-SQL  It's been a while afaik :).  The query seems nicely done tho.  Presumably uniqueness...

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

  • Reply To: T-SQL Parent Child

    ringovski wrote:

    I have 5 country grouping tables with PK & FK foriegn key relationships that store master group names and sub group names each with the relevant country id.

    There are...

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

  • Reply To: Update particular record in a table

    Afaik there are only two possible values for the Category column: { 'Lessthan8', 'greatherthan8' }.  If that's so the query could rely on EXISTS to handle any duplication

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

  • Reply To: Replace calculation in cursor with set based logic

    Regarding the precision of the data types

    cast(Price as decimal(9,7)) Calculation

    The line above CAST's the price (Price) to DECIMAL(9, 7).  Imo this is not a good practice.  When...

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

  • Reply To: Replace calculation in cursor with set based logic

    My query was insufficient because it applied the factor percentage to the lagged price and not to the lagged calculated price.  It seems recursion is unavoidable.  This query uses a...

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

  • Viewing 15 posts - 31 through 45 (of 1,419 total)