cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Collation Error

I have a Power BI project and I'm using DirectQuery. I'm trying to add a table visual. When I drag the value I want to the table field, it gives me the following error:

 

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Arabic_CI_AS" in the equal to operation.. The exception was raised by the IDbCommand interface.

I tried the following: I created a new column from SQL Server that collates the affected column. So it becomes something like this:

 

SELECT [ACCOUNTNUM], [ACCOUNTNUM] collate SQL_Latin1_General_CP1_CI_ as ACCOUNTNUM_2
FROM myTable

When I used the new column it still showed me the same error. I tried changing the collate SQL_Latin1_General_CP1_CI_AS to collate Arabic_CI_AS but still the same error happens.

 

What should I do?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Collation Error

Thank you, but I already found a solution without having to change the collation of the table from SQL Server. I did the following:

 

Create a View of the table you need from SQL Server, but do it like so:

 

USE [enter_database_name_here]
GO

CREATE VIEW [dbo].[enter_view_name_here]
as
Select [column_name] collate SQL_Latin1_General_CP1_CI_AS as new_column_name

from table_name

Basically just collate all the columns. Now you can import or DirectQuery this view and you'll get the data.

 

I hope this helps anyone looking for an answer to this problem.

View solution in original post

4 REPLIES 4
Highlighted
Microsoft
Microsoft

Re: Collation Error

@raghads,


Firstly, please check the collation of the table and columns that you imported into Power BI Desktop using T-SQL. If there is any difference between the collation, the above error would occur.

SELECT DATABASEPROPERTYEX('Yourdatabase', 'Collation')
GO
/* Find Collation of SQL Server Database Table Column */
USE yourdatabase
GO
SELECT name, collation_name
FROM sys.columns
WHERE OBJECT_ID IN (SELECT OBJECT_ID
FROM sys.objects
WHERE type = 'U')


Secondly, in SQL Server, change collation for problem columns with the T-SQL below.

ALTER TABLE dbo.yourtable ALTER COLUMN yourcolumn
            datatype COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL;  
GO  


There is a similar thread for your reference.
https://community.powerbi.com/t5/Integrations-with-Files-and/Couldn-t-load-the-data-for-this-visual-...

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Collation Error

I'm using DirectQuery, so I'm not importing any tables. Currently I don't have the power to change the collation of any table (I'm not an admin). I prefer not to change anything in the SQL Server tables directly.

I'm getting the data from a View. Is there a line of code I could add so I can get the values I need without having to change the original table's collation?

Highlighted
Microsoft
Microsoft

Re: Collation Error

@raghads,

I am afraid that  you would need to ask your SQL Server administrator to change the collation for you. We are unable to solve this issue on Power BI side without changing collation.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Collation Error

Thank you, but I already found a solution without having to change the collation of the table from SQL Server. I did the following:

 

Create a View of the table you need from SQL Server, but do it like so:

 

USE [enter_database_name_here]
GO

CREATE VIEW [dbo].[enter_view_name_here]
as
Select [column_name] collate SQL_Latin1_General_CP1_CI_AS as new_column_name

from table_name

Basically just collate all the columns. Now you can import or DirectQuery this view and you'll get the data.

 

I hope this helps anyone looking for an answer to this problem.

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors