Question : Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI<wbr />_AS" and "Latin1_General_CI_AS" in the equal to operation

Hi ,

I get this problem in the following code

The default collact of Database and table is : SQL_Latin1_General_CP1_CI_AS

What is the Latin1_General_CI_AS ?

This procedure is called from another procedure and the data of #temprpt037Monthqi is generate from caller.

If I craete the table with name [temprpt037Monthqi] , it works well, and if I create the table with name #temprpt037Monthqi so that the procedure can be called concurrently . I get this error.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
ALTER PROCEDURE [dbo].[Report_RPT037_grpKey_Indicator_Performance]
@QcatName nvarchar(50),@QReportType nvarchar(50),@StartDate Datetime
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

declare @NumberOfQuestion int,@ChartType char

select @NumberOfQuestion=count(*) from RegionalReportQI 
	where ReportType=@QReportType and QuestionCategory=@QcatName

select @ChartType=ChartType from RegionalReportQI 
	where ReportType=@QReportType and QuestionCategory=@QcatName
-- Insert statements for procedure here
	
--Get Beddays , Sum of answer for each facility
declare @FacilityValues table
	(
		QuestionCategory varchar(50),
		CareLevel varchar(100), 
		Region varchar(100),
		MemberName varchar(100),
		SumAnswer int,
		BedDays	int,
		Beddays000 float,
		CountOfAnswer int,
		MonthReported float,
		UCAMeans float,
		Expected int,
		ExpectedReal float,
		Lower2s float,
		Lower3s float,
		Upper2s float,
		Upper3s float,
		Flag varchar(20),
		ReportStandard int, --int of Month Reported
		fDementia nvarchar(50),
		avgBeds int,	--avg beds for member
		avgAnswer int	--avg answer for member work with avgbeds to get the new expected value
	);

insert into @FacilityValues (QuestionCategory,CareLevel,Region,MemberName,SumAnswer,BedDays,
CountOfAnswer,MonthReported,fDementia,avgBeds,avgAnswer)
select @QcatName,min([membertype]) as CareLevel,BGName,[Member Name] as MemberName,sum(answer) SumAnswer ,
sum((datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year([monthdate]) as varchar)+'-'+cast(month([monthdate]) as varchar)+'-01' as datetime)))))*beds) AS BedDays,
count(*) As CountofAnswer , cast(count(*) as Decimal)/ @NumberOfQuestion AS [MonthReported],
min(fDementia),
avg(beds),avg(answer)
from #temprpt037Monthqi
where  EQBID in (select qid from regionalreportqi where ReportType =@QReportType and QuestionCategory=@QcatName)
and monthdate>=@StartDate
group by BGName,[member name]  --Line 69
order by BGName,[member name]

--Get the Benchmark Value value  sum(expected value for each question category
if @ChartType='U'
	update TA set TA.UCAMeans=
	(
		select sum(ExpectURate) from #temprpt037BenchMeanQI TB where TB.fmembertype=TA.CareLevel
			and TB.fDementia =TA.fDementia and  --Line 77
			TB.QBID in (select qid from regionalreportqi where ReportType=@QReportType and QuestionCategory=@QcatName)
	)
	From @FacilityValues AS TA

Answer : Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI<wbr />_AS" and "Latin1_General_CI_AS" in the equal to operation

If this does not help then I don't know...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
select distinct mdate as [Monthdate], fmembernumber as [Member Number],fname collate database_default as [Member Name],   
        case  
                when mdate<'2008-12-31' then 'Q08-'+cast(qnum as varchar(10)) 
                when mdate>'2008-12-31' then 'Q09-'+cast(qnum as varchar(10)) 
        end collate database_default as [QI Version], 
        fmembertype collate database_default as MemberType, 
        case 
                when aauditName like '%quarterly%'  then 'Q' 
        else 'M' 
        end collate database_default as [Question Category], 
        qnum as [Question Number] ,  
        answer as [Answer], fbeds as [Beds] , 
        BGName collate database_default,
        aauditname collate database_default,
        qbid,
        fDementia collate database_default,
        EQBID 
into [#temprpt037Monthqi] 
from @tqi2 
where mdate>=@StartDate and mdate<=@EndDate 
--and aauditName like '%quarterly%' 
order by [Question Category],mdate, fname, qnum
Random Solutions  
 
programming4us programming4us