Viewing 15 posts - 1,951 through 1,965 (of 2,858 total)
I am glad I could help! I found the problem to be interesting and fun to work on.
Been a while since I had a fun, challenging SQL query like that...
April 24, 2020 at 5:59 pm
This sounds like a homework assignment...
Question 1 is pretty trivial as you are just using datediff on the Cases table with a WHERE to put the date greater than or...
April 24, 2020 at 5:50 pm
I didn't even notice it dropped trip id 28754... Ok, did ore refactoring and now I get 19 results with most being overlaps of 2 except the last one which...
April 23, 2020 at 9:10 pm
I think it is close, but thinking we are going about this from the wrong approach.
How about something like this:
-- Get initial data
WITH [cte]
AS
(
SELECTDISTINCT
[t].[rn] AS [rn]
,...
April 23, 2020 at 6:11 pm
So, if I understand correctly, as soon as there is an overlap, it is grouped by that. So, if you have for example the following:
INSERT #TestTrips ([rn],...
April 22, 2020 at 5:28 pm
I do agree with you Jeff, I have xp_cmdshell enabled in a lot of places. You just have to be careful with it. It is very easy to turn it...
April 22, 2020 at 5:06 pm
That is what I said it would do: "The new method above only allows 2 trips per overlap grouping. So using my example above of trip 1, 2, and 3...
April 22, 2020 at 4:57 pm
I'm not seeing duplicates... change the "order by" to be by "grouping" and you will see that it is showing you multiple overlaps (ie groups); not duplicates. If trip 1...
April 22, 2020 at 4:09 pm
do you have some sample data where it is doing duplicates? There shouldn't be duplicates as it is doing a distinct already in the CTE...
April 22, 2020 at 3:17 pm
Which is the slow portion of that query? Are ALL of the UPDATEs and INSERTs slow and taking roughly the same time to complete?
Is this a "run-once" query or is...
April 22, 2020 at 2:42 pm
Yep; xp_cmdshell would solve that, but you'd need to enable it and some auditors don't like having that enabled.
UNC paths are likely going to be the safest and most reliable...
April 22, 2020 at 2:35 pm
What is your disk I/O?
One thing that can help is to change your "between" to a > and <. Between comparisons have been known to have performance issues.
On top of...
April 21, 2020 at 9:55 pm
Network drive letters are mapped per user, not per machine. So mapping the drive with "net use" will map the drive for you not the SQL Server Service account. You...
April 21, 2020 at 9:44 pm
The first issue is easy to fix - you are only showing "t" not "t2". So when you join things t and t2 are he ones that overlap. If you...
April 21, 2020 at 9:19 pm
I agree with Ken here that the application side is better suited for this.
Personally, I would refrain from using undocumented features as they can change behavior OR be removed completely...
April 21, 2020 at 2:18 pm
Viewing 15 posts - 1,951 through 1,965 (of 2,858 total)