I have a dimension attribute value as "Us" and "US".
While processing the dimension the SSAS is giving duplicate key error as both the values do not have the same cases.
However in the SQL database this does not seem to be an issue.
Please help me understand why this actually happens
Sounds like your SQL database (or at least that column) uses a case sensitive collation but SSAS uses a case insensitive collation. Can you change both to the same collation? The problem is that a SELECT DISTINCT query in SQL returns a list which isn't distinct according to SSAS and its collation.
Related
We have an old SQL Server database with case sensitive collation, but our newer application code expects column and table names to be case insensitive.
So, we are trying to convert the database so that the column and table names will be case insensitive.
The solution so far is to create an empty DB with case insensitive collation, then generating scripts from the old database to recreate the schema in the new database (using SQL Server Studio), then exporting the data from the old database into the new database.
This almost works, but the old instance allowed for a couple of rows of data that are identical when ignoring case sensitivity and we have a unique constraint violation.
Is there a simple way to allow for SQL references to table and column names to be insensitive while column data is treated as sensitive still (without having to modify the columns individually with separate collations)?
When you create a database, the system tables that hold the object names get the collation of the database -- here you want an insensitive collation. If you then want all your data to be case sensitive still, change the database's default collation, then run your scripts.
Changing the collation will not change the collation of already created objects (including the system tables) but it will affect subsequent objects.
Without changing the column collation at all, you can override it on individual queries, for example WHERE A = 'Hi' COLLATE Latin1_General_CS_AI, but this is inefficient because it will prevent the use of indexes for seeking (as conversions are required). It's not possible to define a constraint with a collation override -- you'd have to get complicated and define it on a computed column with a separate collation.
I have several databases on a SQL Server instance. I have certain queries that extract information simultaneously these databases. It turns out that after restoring of one of the databases (but that came from another server), these queries gives a COLLATION error. I realized then that this "new" database has a different COLLATION, so that forces me to use the COLLATE for each respective column in these queries. The problem is I have many queries and it would not be practical to make this change on all. I have way to change Database COLLATION, as well as all needed columns? I already tried to change the Database but it seems that columns COLLATION remain the same...
If the collation for individual columns are not set to Database default, you should change them one by one.
I'm using SQL Server Data Tools in Microsoft SQL Server 2012 to load data from the staging to the data warehouse. During the ETL process, I use the Lookup Transformation to get the dimension key from the lookup table into my fact table. My issue is that when I use the Full Cache in Lookup Transformation, all the rows went to the no match output. When I use Partial cache or No cache, all the rows went to the match output as is supposed to be. I'm really confused and don't understand what's going on here. I really need some help here.
Thanks,
Dan
If you are looking up based on a VARCHAR or NVARCHAR field, as billinkc has suggested, if the fields are in different cases (Dan Vs dan) this would lead to a no match. Try doing an derived column of UPPER(SourceColumn) and use the query in the lookup Transformation to Select UPPER(MatchingColumn), LookedupKey from LookupTable and match on this.
How to get rid of case-sensitive dependence in database query in Yii, using different ways to access the database, either through Active Record, DAO, and through the query designer.
First of all to avoid case sensitive dependence in database query, you need to make the database case insensitive by setting a flag in configuration file as in MySQL, Which will make all database queries case insensitive
I'm running a project with SSIS and now creating new database with CS (case sensitive) collation, but all queries, stored procedures etc. were written in case-insensitive manner, so now SQL Server doesn't recognize them. I need to change table names, columns names... in queries in exact the same as they are in SQL Server.
Is it possible to have CS database with CI stored procedures, queries and so on... ?
No, case sensitivity at the database level applies to object names. You can, however, create a case insensitive database, and for each text column you create, modify the collation to a case sensitive one. I believe that that would give you the behaviour you ask for.
You can apply collation at the column-level. To do this, right click your table in SQL Server Management Studio, click 'Design' then select the column and in the Column Properties menu under the 'Table Designer' section you can choose to use something other than the database default.
Note, it will not let you change the collation on a column if its part of the primary key.