![]() Here are a few things to note about the statement above: If we go one step further, and create the temporary table ourselves, this may yield another problem, take a look at the script below:ĭropping and re-creating the #TMP_CUSTOMERS prior to inserting records ![]() Later on, when we run the update statement the column customer_name in the temporary table's collation setting collide with the target database CUSTOMERS table's customer_name column that has Latin1_General_CI_AI set as the collation for the customer_name column. Latin1_General_CI_AI), so when we copy the data from the source database the #TMP_CUSTOMERS temporary table inherits the collation setting for the customer_name column from the source database which is Latin1_General_CI_AS. In the example above, I have created the source and target tables with different collations (Latin1_General_CI_AS vs. The error is raised because we asked SQL Server to compare two columns (customer_name in table CUSTOMERS and customer_name in table #TMP_CUSTOMERS) which have different collation settings, so SQL Server tells us it cannot compare two strings with different collations. Select * into #TMP_CUSTOMERS from source.CUSTOMERS Īssuming that the source database is called "source" and that the target database is called "target" the query from step 2 above would look like:Ĭannot resolve the collation conflict between "Latin1_General_CI_AS" and "Latin1_General_CI_AI" in the equal to operation. If OBJECT_ID('tempdb.#TMP_CUSTOMERS') is not null Insert into CUSTOMERS (customer_id, customer_name, phone_number) Insert into CUSTOMERS (customer_id, customer_name, sales_2010)Ĭustomer_name varchar(20) not null unique, If OBJECT_ID('CUSTOMERS') is not null drop table CUSTOMERS Ĭreate table CUSTOMERS(customer_id int not null primary key,Ĭustomer_name varchar(20) not null unique, sales_2010 int) If exists (select null from sys.databases where name like 'target')Ĭreate database source collate Latin1_General_CI_AS Ĭreate database target collate Latin1_General_CI_AI For purposes of New York and New Jersey State ethics rules, please take notice that this website and its case reviews may constitute attorney advertising.If exists (select null from sys.databases where name like 'source') Before making any decision or accepting any legal advice, you should have a proper legal consultation with a licensed attorney with whom you have an attorney-client privilege. It is not a substitute for professional legal assistance. All information available on our site is available on an "AS-IS" basis. It is possible that the law may not apply to you and may have changed from the time a post was made. The law is also subject to change from time to time and legal statutes and regulations vary between states. The people providing legal help and who respond are volunteers who may not be lawyers, legal professionals or have any legal training or experience. When you submit a question or make a comment on our site or in our law forum, you clearly imply that you are interested in receiving answers, opinions and responses from other people. Legal Disclaimer: The content appearing on our website is for general information purposes only.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |