Viewing 15 posts - 571 through 585 (of 1,419 total)
It's a one time only type query or it's intended to be run frequently? The id value in the last row of the sample data should be 5, no?
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 28, 2021 at 8:20 pm
O sorry, I was thinking you meant 2nd from the end. I seemed to have missed the date range part too
declare @StartDate DATE = '2021-09-24', @EndDate DATE...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 27, 2021 at 6:08 pm
You could try using ROW_NUMBER twice. Once to find the most recent row within the MyIdentifier partition and then again to find the 2nd oldest row (also within the MyIdentifier...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 27, 2021 at 5:20 pm
Call it what you want, using a GUID to "represent the PK" or vice versa makes no sense to me. Both columns are fixed width (unless you've done row...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 26, 2021 at 10:53 pm
Maybe it was incorrect to label the GUID column 'guid_id' because it was intended as a public attribute of the primary key. Maybe it would be better labelled as 'securitystamp'...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 26, 2021 at 9:35 pm
Thank you Jeff. On some projects we've had logical/physical GUID issues (or idk what to call it, let's say it's the subject of ongoing analysis) which we've sort of managed...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 26, 2021 at 6:50 pm
So, they came up with a workaround as below.
- Introduced a new column as BIGINT column.
- Made the bigint column as NOT NULL IDENTITY(1,1) with clustered index on it
-...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 26, 2021 at 1:16 pm
Good idea but I'm hoping that you don't think that I didn't know that. 😀 It doesn't matter as much as it did before but there used to be...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 25, 2021 at 12:04 pm
Ha, nice Jeff. @@DATEFIRST returns 7 on my test instance so no worries there. In the tvf it seems possible to factor out a common table expression and the UNION...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 24, 2021 at 7:14 pm
I'd be real careful with that. It uses the WEEKDAY date part, which is subject to change and most recommend not using it for such calculations. I avoid its...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 24, 2021 at 3:35 pm
Heh... one good test result is worth a thousand expert opinions. 😀
This 🙂
You ran a comparison?
Would we need to? A single math calc vs iterating thru string...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 24, 2021 at 12:28 pm
I've amended your code. I think this should be a few times faster as it removes the need for a tally of 7 week days and just calculates the...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 24, 2021 at 12:05 pm
Here's another version which replaces the second dbo.fnTally tvf with an explicit values table (0-6) and which eliminates the outer WHERE clause by adding the row filter to the final...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 22, 2021 at 1:03 pm
Thank you Jeff. It's my pleasure of course. Please let me know if there's anything else I could do
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 21, 2021 at 9:54 pm
You ran a comparison?
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 21, 2021 at 7:25 pm
Viewing 15 posts - 571 through 585 (of 1,419 total)