Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-11 : 10:39:17
|
| Hi friendsHope you are all well?I need help with this error message:cannot resolve collation conflict for equal to operation.This occurs for the two delete commands at the bottom of the stored procedure but I don't understand what is causing this.declare @tabledupe table(lrid varchar)declare @tablerepeat table(lrid varchar)INSERT INTO @tabledupe(lrid)SELECT tb_lrproperties.prop_branchref FROM tb_properties left jointb_lrproperties On tb_properties.prop_postcode = tb_lrproperties.prop_postcodeWHEREtb_lrproperties.prop_name = tb_properties.prop_nameinsert into @tablerepeat(lrid)SELECT prop_branchref FROM tb_lrpropertiesGROUP BY prop_branchrefHAVING ( COUNT(prop_branchref) > 1 )select lrid from @tabledupeDELETE tb_lrproperties where prop_branchref in (select lrid from @tabledupe) DELETE tb_lrproperties where prop_branchref in (select lrid from @tablerepeat) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 10:42:13
|
quote: Originally posted by godspeedba Hi friendsHope you are all well?I need help with this error message:cannot resolve collation conflict for equal to operation.This occurs for the two delete commands at the bottom of the stored procedure but I don't understand what is causing this.declare @tabledupe table(lrid varchar)declare @tablerepeat table(lrid varchar)INSERT INTO @tabledupe(lrid)SELECT tb_lrproperties.prop_branchref FROM tb_properties left jointb_lrproperties On tb_properties.prop_postcode COLLATE DATABASE_DEFAULT= tb_lrproperties.prop_postcode COLLATE DATABASE_DEFAULTWHEREtb_lrproperties.prop_name COLLATE DATABASE_DEFAULT= tb_properties.prop_name COLLATE DATABASE_DEFAULTinsert into @tablerepeat(lrid)SELECT prop_branchref FROM tb_lrpropertiesGROUP BY prop_branchrefHAVING ( COUNT(prop_branchref) > 1 )select lrid from @tabledupeDELETE tb_lrproperties where prop_branchref in (select lrid from @tabledupe) DELETE tb_lrproperties where prop_branchref in (select lrid from @tablerepeat)
modify like above------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-11 : 10:46:05
|
| I still get the same message :( |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 10:49:20
|
| what are the other character fields that are used in comparison. add the same clause to other comparison statements too------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-11 : 10:56:16
|
| Instead of putting the data into a temp table I used the delete from in front the sections that put data into the temptable.These seems to have solved it. Thanks for your time Visakh |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-11 : 12:37:05
|
| Whenever we create a #TEMP or @TableVar table we explicitly define the Collation on any Varchar/Char/Text column. Thus if TEMPDB (i.e. Server Default) collation is different to the Current Database we don't get collation errors when we reference the columns in the Temp table.Bit of a PITA, but it does make your application collation-neutral if it is moved to a server with a different collation.Only time we need to be careful is when comparing columns between databases which have different collations (data import from another application's DB, for example) |
 |
|
|
|
|
|