Viewing 15 posts - 376 through 390 (of 1,491 total)
Thank you very much, but if I get rid of functions my code will not give what I need.
WHERE pd.ClientId = 164
AND pd.DateProcessed >= DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), -1)
AND...
October 1, 2021 at 5:44 pm
this looks familiar
I think both windowed and brute force approaches have their place. I have just tidied up my code to try and make it more understandable:
September 29, 2021 at 10:27 am
WITH PrevEnds
AS
(
SELECT E.code_events, E.[Events], E.Events_start, E.Events_end
,LAG(E.Events_end) OVER (PARTITION BY E.code_events ORDER BY E.Events_start) AS Prev_Events_end
...
September 28, 2021 at 8:23 pm
You have posted in a SQL2019 forum but do not say what COMPATIBILITY_LEVEL your database is using.
If COMPATIBILITY_LEVEL >= 120 you could also try OPTION (QUERYTRACEON 9481)
If COMPATIBILITY_LEVEL < 120...
September 27, 2021 at 8:09 pm
If the query apart from the WHERE and ORDER BY clauses is outside your control you could try:
WHERE (EA.IsArchived = 'F' OR EA.IsArchived IS NULL) AND EN.Name...
September 24, 2021 at 7:30 pm
Do not do this - it will mess up the query plan.
If the query is complicated then put it in a view and select from the view with different WHERE...
September 23, 2021 at 9:32 am
You are right. I missed it because our two SQL2019 servers were created after I had spotted the problem in SQL2017 so used the test restore routine which ignored error...
September 20, 2021 at 9:41 am
For the session's default database:
SELECT
CASE S.transaction_isolation_level
WHEN 0 THEN 'Unspecified'
WHEN 1 THEN 'Read Uncommitted'
WHEN 2 THEN 'Read Committed'
WHEN 3 THEN 'Repeatable Read'
WHEN 4 THEN 'Serializable'
WHEN 5...
September 15, 2021 at 2:08 pm
I suspect you need to use the FIRST_VALUE() and LAST_VALUE() windowed functions but without test data it is difficult to say.
With over 800 points you should know how to post...
September 8, 2021 at 3:05 pm
As mentioned in the link below,
For client-side applications, query notification users should not exceed ten concurrent users , in SQL Server 2005.
Will there be any performance degradation if...
August 19, 2021 at 9:50 am
or using Windowed functions:
WITH Gaps
AS
(
SELECT ID, eff_dt, term_dt, prod
,CASE
WHEN eff_dt = DATEADD(DAY, 1, LAG(term_dt) OVER (PARTITION BY ID, Prod ORDER BY eff_dt))
THEN 0
ELSE 1
END AS Gap
FROM #memb
)
,Grps
AS
(
SELECT...
August 17, 2021 at 8:00 am
I have no idea why you want to do this but you could try the pivoting the results of the OUTPUT clause. eg:
DECLARE @ForSecond TABLE
(
...
August 11, 2021 at 6:43 pm
I am glad the solution works.
If you find recursion to be too slow you might also want to consider the Quirky Update:
This does have the overhead of having to...
August 5, 2021 at 9:20 am
If this is really a picking algorithm it looks somewhat simplistic to me. In my limited expericence picking algorithms tend to be a lot more complex and are best done...
August 3, 2021 at 8:06 pm
That data will certainly break my first effort. The safe, albeit slow, use of recursion produces slightly different results to you but maybe my understanding of the problem is wrong.
August 3, 2021 at 3:57 pm
Viewing 15 posts - 376 through 390 (of 1,491 total)