Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with Cannot resolve collation confilct error
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Eagle_f90
Constraint Violating Yak Guru

USA
424 Posts

Posted - 09/11/2013 :  10:49:02  Show Profile  Visit Eagle_f90's Homepage  Reply with Quote
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

India
52326 Posts

Posted - 09/12/2013 :  16:33:56  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000