Viewing 15 posts - 16 through 30 (of 1,398 total)
There are examples on the internet of how to recursively assign HIERARCHYID. A while ago on this forum:
My reply in the SSC forum was based on this Stack...
May 10, 2025 at 3:58 pm
"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...
May 10, 2025 at 3:31 pm
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...
May 6, 2025 at 3:34 pm
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...
May 3, 2025 at 2:17 pm
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
April 24, 2025 at 10:26 pm
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...
April 14, 2025 at 5:40 pm
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...
April 13, 2025 at 3:48 am
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...
April 9, 2025 at 6:13 pm
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...
April 7, 2025 at 11:07 am
with stub_cte as (
select BName, StartDate, StartTime,
lag(StartDate) over (partition by v.stub...
February 22, 2025 at 9:44 pm
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 ... ...
January 24, 2025 at 1:28 am
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...
January 16, 2025 at 2:21 pm
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...
January 14, 2025 at 3:18 pm
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...
January 12, 2025 at 3:44 pm
Where's your sample data? A calendar table determines the workdays? This is asking a bit. Using AVG OVER can only accept literal numbers in the RANGE PRECEDING and afaik it...
December 28, 2024 at 9:36 pm
Viewing 15 posts - 16 through 30 (of 1,398 total)