Viewing 15 posts - 376 through 390 (of 2,648 total)
I am trying commands separately to understand. Will update if I have any questions.
This is the dynamic SQL that is created:
SELECT VID, [2022-01-10], [2022-01-11], [2022-01-12]
...
June 15, 2023 at 7:18 pm
Here's another one query solution.
Finished in about 3 seconds for prime numbers up to 1 million (on my machine).
I can't test it against SwePeso's solution as I...
June 15, 2023 at 6:00 pm
A simplified version is found here https://www.sqltopia.com/mathematics/prime-number-generation/
Very good and a clear explanation of how it works.
June 15, 2023 at 12:17 pm
CREATE TABLE #t1([VID] [varchar](100) NULL,[OrdDate] [datetime] NOT NULL, [FldVal] int NULL ) ON [PRIMARY]
insert into #t1 values('111','2022-01-10',10)
insert into #t1 values('111','2022-01-11',1)
insert into #t1 values('111','2022-01-12',2)
-- Generate dynamic column names...
June 15, 2023 at 12:50 am
Peter "Peso" Larsson wrote a nasty fast Prime Numbers function years ago and I tested it to confirm it. I'll see if I can find it in my archives...
June 14, 2023 at 6:31 pm
You only need to test up to the square root of a number to test for primality, which is quite a saving:
declare @n ...
June 14, 2023 at 3:51 pm
I think the script in the article is a bit of a non-starter.
It is calculating the square root multiple times for each row.
June 14, 2023 at 3:23 pm
You only need to test up to the square root of a number to test for primality, which is quite a saving:
declare @n ...
June 14, 2023 at 1:48 pm
For exhaustive methods it's quicker to only look at odd numbers. There was a Youtube video a little while ago where they compared all different programming languages to determine...
June 14, 2023 at 11:57 am
I wrote this SQL Server table valued function a few years ago. It returns all the prime numbers less than 1 million in about 1 second.
June 14, 2023 at 9:32 am
Thank you, Jonathan. Almost every step in the execution plan now marked as "No Join Predicate" and the whole function now costs 100% with my original tally one...
June 13, 2023 at 6:45 pm
Thank you, Phil - the execution plan is the same. And same as with my tally table, 94% of it goes on INSERT INTO @t table
You don't need to...
June 13, 2023 at 4:16 pm
;WITH CTE AS
(
SELECT oven,
T.Hours,
...
June 6, 2023 at 1:16 am
Got no idea if this will work as you haven't posted any consumable data:
;WITH CTE AS
(
SELECT System,
...
June 5, 2023 at 10:03 pm
Viewing 15 posts - 376 through 390 (of 2,648 total)