June 18, 2013 at 9:23 am
I have been trying to join 3 different tables from 2 different servers and I am having some success but have reached a wall.
Query (figured I show the actual)
Select *
FROM [VisNetic Mailflow].[dbo].[Tickets] [t]
left join
[VisNetic Mailflow].[dbo].[TicketHistory]
on [t].[ticketid] =
.[ticketid]
left join
[VisNetic Mailflow].[dbo].[Agents] [a]
on
.[AgentID] = [a].[AgentID]
left join
[VisNetic Mailflow].[dbo].[TicketBoxes] [tb]
on [t].[TicketBoxID] = [tb].[TicketBoxID]
left join
[VisNetic Mailflow].[dbo].[TicketStates] [ts]
on [t].[TicketStateID] = [ts].[TicketStateID]
left join
[VisNetic Mailflow].[dbo].[TicketActions] [ta]
on
.[TicketActionID] = [ta].[TicketActionID]
left join
[VisNetic Mailflow].[dbo].[AgentGroupings] [ag]
on
.[AgentID] = [ag].[AgentID]
left join
[VisNetic Mailflow].[dbo].[Groups] [g]
on [g].[GroupID] = [ag].[GroupID]
left join
[VisNetic Mailflow].[dbo].[OutboundMessages] [om]
on [t].[TicketID] = [om].[TicketID]
left join
[PDO_Live].[dbo].[ACCOUNT] [ac]
on [t].[Contacts] = [ac].[STR_EMAIL_ADDRESS]
left join
[PDO_Live].[dbo].[vwAPPLICATION_SUMMARY] [vwapp]
on [t].[Contacts] = [vwapp].[STR_EMAIL_ADDRESS]
left join
[I3_IC].[dbo].[CallDetail] [cd]
on [t].[Contacts] = [cd].[RemoteNumberFmt]
where [t].[DateCreated] between '05-01-2013' and '05-02-2013'
and
.[TicketBoxID] = '16'
Order by [t].[DateCreated]
and then take and join with [Server2].[db3].[arrival].
**The end result would be to show where the unique incident lead to the 1st call(HH:mm:ss) after the incident took place.
when I execute the query I get the error *** Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP1_CI_AI" in the equal to operation. ***
June 18, 2013 at 9:47 am
does the following help you?
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
June 18, 2013 at 11:09 am
You need to use the same collation for both sides of your comparison.
In your situation, one server ignores accent marks when comparing, the other includes accent marks in the comparison.
If one server is set to 'HELENA' = 'HÉLÈNA' and the other is set to 'HELENA' <> 'HÉLÈNA', when you cross server boundaries using different collations with 'HELENA' = 'HÉLÈNA', the server doesn't know how to answer the question.
Set one side of your comparison to match the collation of the other.
http://msdn.microsoft.com/en-us/library/ms184391.aspx
Wes
(A solid design is always preferable to a creative workaround)
June 18, 2013 at 11:22 am
Thank you--- Error is gone, but Runtime is long.
Any ideas on reducing runtime?
June 18, 2013 at 11:32 am
Assuming your indexes are appropriate for your query;
Create a view to pre-filter your data on the remote server. Ideally, create a single view that has all of the joins and data columns you need from the remote server. That way the remote server will take some of the load of filtering and joining. Use the view in your query to only retrive the data that you need from the remote server.
In a linked server join, the host server retrieves ALL of the rows from the source tables before attempting the join. It then performs the joins and filters locally.
Wes
(A solid design is always preferable to a creative workaround)
June 18, 2013 at 12:30 pm
whenriksen (6/18/2013)
Assuming your indexes are appropriate for your query;Create a view to pre-filter your data on the remote server. Ideally, create a single view that has all of the joins and data columns you need from the remote server. That way the remote server will take some of the load of filtering and joining. Use the view in your query to only retrive the data that you need from the remote server.
In a linked server join, the host server retrieves ALL of the rows from the source tables before attempting the join. It then performs the joins and filters locally.
Ok. Thank you.
I am also wanting the unique events for each ticket and I am getting multiples. Why is that?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply