← Back to Knowledge Base

KB #240034: Error – Cannot resolve collation conflict for concatenation operation

⏱️ 2 min read

Type:

Fix

Summary:

When encrypting or decrypting a column when using a non-Western version of SQL Server, you may receive an error similar to the following:

  Server: Msg 446, Level 16
  Cannot resolve collation conflict for concatenation operation.

Important: this can potentially lead to corruption of the data in the column

Additional Information:

Encryptionizer installs the UDFs in Master. If the Collation Value of the target database does not match the Collation Value of Master, SQL Server may become confused when trying to encrypt or decrypt a column or variable using one of the fn_n_encrypt_ or fn_n_decrypt_ functions.The solution is to install the UDFs in the database which contains the columns being encrypted. In fact, we recommend this solution even if the collation values do match.

To install and use the UDFs in the target database, modify ADD_UDF_XP.SQL and comment out the following line:

   USE MASTER

Then use Query Analyzer to run ADD_UDF_XP.SQL in the desired database.Finally, modify any function calls to refer to the current database, rather than Master. For example, change:

  update customer set CreditCard = 
       master.dbo.fn_n_encrypt_char(@cc,0,0,1)

– to –

  update customer set CreditCard = 
       dbo.fn_n_encrypt_char(@cc,0,0,1)

Tip:The Collation Name can be found in Enterprise Manager under the Database Properties (right click on database name).

The Collation Name can be found in Query Analyzer by querying the ‘collation’ property with DatabasePropertyEx. E.g.,

   select DatabasePropertyEx('Northwind','collation')

Related Topics:

240028: How to Install APIs Manually

Was this article helpful?

Related Articles

KB #240093: Cannot Restore from an encrypted SQL backup on a Compressed volume

  Type: Known Issues Summary: Creating an encrypted SQL backup on a compressed drive appears…

KB #240101: Test the encryption state of a SQL database or backup

Type: Information Summary: There are several methods of determining whether SQL Database files are encrypted.…

KB #240150: Upgrading Operating System on a machine with Encryptionizer installed (v2201.1.0 and later)

Type: Information Summary: You are upgrading the operating system of a machine in place, and…

Still need help?

Our support team is here to assist you.

NetLib Security
AI Assistant · Online
Hi! I'm the NetLib Security assistant. I can answer questions about our encryption solutions, HIPAA compliance, Encryptionizer, and more. How can I help you today?