Forum Replies Created

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

  • 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...

    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...

    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

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

    Why are you using these data types with this numerical precision?  By making @Factor DECIMAL (9,7) and applying this percentage to a price it adds significance to decimal places to...

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

  • Reply To: Count of Distinct Values

    One way to unpivot unique values (of columns [Emp_1], [emp_2], [Emp_3]) could be to CROSS APPLY their UNOIN. The syntax might appear to be unusual because the subquery doesn't contain...

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

  • Reply To: Query Help to show record in single row

    with stub_cte as (
    select BName, StartDate, StartTime,
    lag(StartDate) over (partition by v.stub...

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

  • Reply To: Final SELECT with WHERE based on passing in variable from Dropdown box

    The @dateChoice variable is passed in from a dropdown box and the WHERE clauses between the two queries are different.  Syntax-wise you could try IF @dateChoice = 'DOS' SELECT ... ...

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

  • Reply To: Help with parent/child query please

    The only relational operator which seems required is a partial CROSS JOIN of #tmp (WHERE 'parent_id' IS NULL) to #tmp (WHERE 'parent_id' IS NOT NULL) ON 'uniqueid'.  Then it's a...

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

  • Reply To: Read data from json file

    In your JSON the outermost delimiter is an array bracket which means it's an anonymous array.  To reference the only record in the array you could provide the 'path' to...

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

  • Reply To: Read data from json file

    In the function JSON_VALUE 'path' is a required parameter and in the tvf OPENJSON 'path' is optional. The implementation of 'json path' in SQL Server is a limited subset of...

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

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