Viewing 15 posts - 811 through 825 (of 2,648 total)
Have you tried the options: optimize for unknown and recompile?
September 27, 2021 at 2:30 pm
That is not really consumable data as I don't have all your tables that make up the query.
You could add an identity column to the temporary table then insert values...
September 27, 2021 at 2:27 pm
Have you thought about upgrading your server?
not an option i'm afraid. this is what i have to work with.
i have done what you suggest though and used a...
September 27, 2021 at 2:10 pm
I can't see how your SQL will work with all those right brackets?
September 27, 2021 at 1:48 pm
i'm not sure either of those will work with SQL 2000? i know LAG isn't supported. and i don't believe PARTITION is supported in SQL 2000 either?
Have you thought...
September 27, 2021 at 1:26 pm
Add a cCTE to what you're talking about and let's race. 😉
I was wondering how a Dates table would compare to your function.
Here is some code to generate a...
September 27, 2021 at 12:34 pm
You should provide consumable date like this:
IF OBJECT_ID('tempdb..#temp','U') is not null
drop table #temp
select *
into #temp
from (values
('GIPAQ','2021-09-19 07:30:00.000', '2021-09-19 08:45:00.000'),
('GIPAQ','2021-09-19... September 27, 2021 at 11:05 am
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. ...
September 24, 2021 at 4:13 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...
September 24, 2021 at 3:56 pm
September 24, 2021 at 3:51 pm
It doesn't make any sense to write the SQL as you have.
You have a LEFT JOIN EntityAttributes EA, but you also have WHERE EA.IsArchived = 'F'
That means your LEFT JOIN...
September 24, 2021 at 3:42 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...
September 23, 2021 at 11:45 pm
I would use a cursor for each query in a loop and build up the text you want as an nvarchar(MAX) variable.
Then just use the text you have built up...
September 23, 2021 at 5:02 pm
This way is much more efficient than my previous effort to get the Nth occurrence of any weekday for an entire year:
declare @year varchar(20) = '2021'
declare @Weekday...
September 22, 2021 at 10:10 pm
Practically, methods like that work just fine. Technically, it bugs me because the "Tally" sequence generator had to build 366 values and then were filtered out to just 12...
September 22, 2021 at 1:18 pm
Viewing 15 posts - 811 through 825 (of 2,648 total)