SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Collation Conflict


Collation Conflict

Author
Message
SQLbeginner
SQLbeginner
SSC Journeyman
SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)

Group: General Forum Members
Points: 86 Visits: 249
Can anyone help explain a way to resolve the error I receive from the following statement:

-------------------------------------------------------------------------------------------------
select distinct a.jobid, a.custphoneno, a.dispatchregionid,a.originalduedate,a.timeofdump
,c.sector
,null as Action_Taken
,referaltime
from mcommopenorders a
join
(select phone ,referaltime
from occ_archives.dbo.tbl_R15analysis
where (replace(left(referaltime,8),'-','') >= convert(varchar,getdate()-1,12))
union
select custphoneno, eventdatetime
from occ.dbo.tbl_R15OrdersToday) as b
on a.custphoneno = b.phone
left join zones c
on a.Da collate Latin1_General_CI_AS = c.Dispatchareas collate Latin1_General_CI_AS
where (left(address,4)='!MC!')
and (pattern is null)
and (jobstatus in ('PENDING_DISPATCH','ASSIGNED'))
and (dispatchtypecategory ='SA-Cable'
or dispatchtypecategory is null)
and (workforcerequired = 'g')
and (convert(varchar,a.originalduedate,112) = convert(varchar,getdate(),112))
and (sector not like '%Aliant')
and (convert(varchar,a.assignedfordate,112) = convert(varchar,getdate(),112)or a.assignedfordate
is null)
-------------------------------------------------------------------------------------------------

Msg 468, Level 16, State 9, Procedure vu_R15_Potential2ndMisses, Line 3
Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the UNION operation.

Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)

Group: General Forum Members
Points: 51336 Visits: 38684
Can you provide the DDL (create statement) for the tables including collation for character columns?

Cool

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
SQLbeginner
SQLbeginner
SSC Journeyman
SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)

Group: General Forum Members
Points: 86 Visits: 249
Hi,

It's actually a View, not a table.
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)

Group: General Forum Members
Points: 51336 Visits: 38684
Still need the DDL for the under lying tables to the view.

Cool

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
SQLbeginner
SQLbeginner
SSC Journeyman
SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)

Group: General Forum Members
Points: 86 Visits: 249
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MCommOpenOrders](
[JOBID] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SERVICEORDERNUM] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DUEDATE] [datetime] NULL,
[ORIGINALDUEDATE] [datetime] NULL,
[JOBSTATUS] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHUNITID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[STATUSUPDATEDBY] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[JOBTYPE] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHREGIONID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[WORKGROUP] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DA] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DURATION] [numeric](20, 0) NULL,
[APPTSTARTTIME] [datetime] NULL,
[APPTENDTIME] [datetime] NULL,
[NAME] [varchar](90) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ASSIGNEDFORDATE] [datetime] NULL,
[ADDRESS] [varchar](339) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CUSTPHONENO] [varchar](42) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BCRIS_CALENDER] [varchar](32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CREATIONDATE] [datetime] NULL,
[TROUBLECATEGORY] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHTYPECATEGORY] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[WORKFORCEREQUIRED] [varchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PATTERN] [varchar](11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SERVICEAFFECTING] [varchar](25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHDATETIME] [datetime] NULL,
[TimeOfDump] [datetime] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
-------------------------------------------------------------------------------------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_R15analysis](
[OriginalCt] [varchar](22) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[R15Ct] [varchar](22) COLLATE Latin1_General_CI_AI NULL,
[Phone] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[jobtype] [varchar](22) COLLATE Latin1_General_CI_AI NULL,
[troublecategory] [varchar](22) COLLATE Latin1_General_CI_AI NULL,
[wfr] [varchar](6) COLLATE Latin1_General_CI_AI NULL,
[workgroup] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Region] [varchar](22) COLLATE Latin1_General_CI_AI NULL,
[originalduedate] [datetime] NULL,
[CurrentDuedate] [datetime] NULL,
[CurrentTech] [varchar](22) COLLATE Latin1_General_CI_AI NULL,
[Coded_By] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[referaltime] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Bell_Received] [datetime] NULL,
[DP1id] [varchar](5) COLLATE Latin1_General_CI_AI NULL,
[dp1tm] [datetime] NULL,
[dp2id] [varchar](5) COLLATE Latin1_General_CI_AI NULL,
[dp2tm] [datetime] NULL,
[CT] [datetime] NULL,
[DISP] [varchar](5) COLLATE Latin1_General_CI_AI NULL,
[timeofdump] [datetime] NULL,
[TroubleRcd] [varchar](10) COLLATE Latin1_General_CI_AI NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
-------------------------------------------------------------------------------------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_R15OrdersToday](
[ID] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[NPA] [varchar](42) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CUSTPHONENO] [varchar](42) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DUEDATE] [datetime] NULL,
[JOBTYPEID] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TROUBLECATEGORY] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[REASONCODE] [varchar](25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TECHID] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHAREAID] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DISPATCHREGIONID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[WORKGRPID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CREATIONDATE] [datetime] NULL,
[TROUBLERECEIVEDDATE] [datetime] NULL,
[eventDateTime] [datetime] NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
homebrew01
homebrew01
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6297 Visits: 9177
What about "zones" ?



SQLbeginner
SQLbeginner
SSC Journeyman
SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)

Group: General Forum Members
Points: 86 Visits: 249
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ZONES](
[ZoneProfile] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
[Dispatchareas] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
[Dispatchregions] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
[Sector] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
[TierC_Group] [varchar](10) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
homebrew01
homebrew01
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6297 Visits: 9177
What are the collation settings for all the databases involved ?



SQLbeginner
SQLbeginner
SSC Journeyman
SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)SSC Journeyman (86 reputation)

Group: General Forum Members
Points: 86 Visits: 249
There are two databases called OCC and OCC_ARCHIVES.

OCC has the collation setting Latin1_General_CI_AS
- tables MCommOpenOrders, tbl_R15OrdersToday and Zones are under this database

OCC_ARCHIVES has the collation setting Latin1_General_CI_AI
- table tbl_R15_analysis falls under this database
nary
nary
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1773 Visits: 1449
Try COLLATE function in your query,
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search