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 |
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2013-09-11 : 10:49:02
|
I am writing a script and when I run it I get the error:
quote: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP850_CI_AS" in the equal to operation.
If is happening ion the 3rd IF statement when it is evaluating the variable, if I comment out the code the script works fine, how can I fix this?
DECLARE @Source varchar(25);
SET @Source = 'DOD'; /* Source options are: DOD SPRAGUEENERGY SRAPROD */
IF (@Source = 'DOD') BEGIN USE DOD;
END
IF(@Source = 'SPRAGUEENERGY') BEGIN USE SPRAGUEENERGY;
END
IF (@Source = 'SRAPROD') BEGIN USE SRAPROD; END
-- If I get used to envying others... Those things about my self I pride will slowly fade away. -Stellvia |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-12 : 16:33:56
|
use COLLATE to override default collation
something like
IF (@Source COLLATE database_default = 'SRAPROD' COLLATE database_default)
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs |
 |
|
|
|
|