Viewing 15 posts - 901 through 915 (of 7,608 total)
I suspect there's some way to do this without recursion, but for now, here's a method using recursion.
DECLARE @amount_to_spend decimal(9, 2)
SET @amount_to_spend = 50.00
;WITH cte_products_by_price AS (
...
April 22, 2022 at 8:00 pm
;WITH
cte_tally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
),
cte_tally100 AS (
SELECT 0 AS number UNION ALL
SELECT...
April 22, 2022 at 7:23 pm
I don't think you don't need an explicit COMMIT and ROLLBACK. In SQL Server, by default each SQL statement that modifies data will be in its own transaction.
Specify "SET XACT_ABORT...
April 21, 2022 at 2:41 pm
but my understanding is that the -kill command does not kill connections that are in "Rollback" and unfortunately, we seem to have connections in ROLLBACK.
To the first point, there's...
April 18, 2022 at 6:51 pm
One place to start is reviewing the "Top 10 Avg I/O Queries". See if anything stands out there.
Next I'd review the index stats. Looking particularly at missing indexes and the...
April 15, 2022 at 7:31 pm
ScottPletcher wrote:Didn't you already ask this q?!
According to the OPs profile, no. In fact, this appears to be the first and only question they've posted.
OK. Sorry, my bad, it...
April 15, 2022 at 3:30 pm
Didn't you already ask this q?!
April 14, 2022 at 6:35 pm
Yes, there is a better way. You can use CROSS APPLY(s) to assign alias name(s).
SELECT [Date Req Created], [Date Initiated], ...
FROM ...
CROSS APPLY (
SELECT NULLIF(A.CALC_Date_EOIReceived,...
April 14, 2022 at 2:55 pm
(1) Download SQL Server Developer Edition. (Hint: it's free!)
(2) Get books by Itzik Ben-Gan (for T-SQL learning) or, for DBA/system learning, the "Inside SQL Server" books by MS.
(3) Do the...
April 12, 2022 at 6:00 pm
CREATE UNIQUE INDEX IX_ID2 ON #IndexTEST(ID2) INCLUDE (ID);creates unique constraint, exactly as you requested.
Second statement is not needed at all.
Technically that's just a unique index,...
April 11, 2022 at 3:18 pm
The indexes will come along. Since they are part of the db, they get restored with it.
April 8, 2022 at 9:17 pm
For more specific tuning, yes, we must see the query plan and the DDL for the table(s) involved, including all indexes.
April 8, 2022 at 5:51 pm
Cost Threshold for Parallelism = 5
Max Degree of Parallelism = 12
Are these values correct?
Definitely not for the first one. Bump that up to at least 40:
EXEC sys.sp_configure...
April 8, 2022 at 5:50 pm
Note the "<" in the comparison; that is required. This handles due_date correctly whether it is a datetime data type or a date.
;WITH cte_get_max_due_date AS (
...
April 8, 2022 at 5:44 pm
Viewing 15 posts - 901 through 915 (of 7,608 total)