当没有牵涉到两个不同的数据库时,出现以上错误. 
 Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

今天在创建一个存储过程时出现错误提示:

cannot resolve the collation conflict between "chinese_prc_ci_as" and "sql_latin1_general_cp1_ci_as" in the equal to operation

是一个字段的的collation设置为了sql_latin1_general_cp1_ci_as,执行下面的SQL,改为database_default即可:

ALTER TABLE blog_Content ALTER COLUMN SourceUrl nvarchar(200) COLLATE database_default NULL

转自:http://www.cnblogs.com/dudu/archive/2011/01/11/1933203.html

例如:

USE [febdb_HNA]
GO
/****** Object: StoredProcedure [dbo].[usp_Report_LoggedInAndSubmitted] Script Date: 11/12/2015 11:21:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO ALTER procedure [dbo].[usp_Report_LoggedInAndSubmitted]
@enrollmentId uniqueidentifier
as
--团险选择报告
begin
SET NOCOUNT ON;
--1、定义结果集
create table #tempLoggedInAndSubmittedReport
(
-------------报表需求字段-----------------
InstitutionCode nvarchar(50),--机构代码 COLLATE database_default null
PersonOfInstitution int,--机构人数
LoggedInPerson int,--机构登录人数
SubmittedPersion int--机构注册完成人数
-------------报表需求字段-----------------
);
--1 得到所有机构,及其总人数
insert into #tempLoggedInAndSubmittedReport(InstitutionCode,PersonOfInstitution)
(select distinct InstitutionCode,count(1) as PersonOfInstitution from Employee where Id in(select EmployeeId from EnrollmentEmployee where EnrollmentId=@enrollmentId)
group by InstitutionCode)
--2 得到登录员工
update a set a.LoggedInPerson=b.LoggedInPerson from #tempLoggedInAndSubmittedReport a join
(select distinct InstitutionCode,count(1) as LoggedInPerson from Employee where Id in
(select EmployeeId from EnrollmentEmployee where EnrollmentId=@enrollmentId and HasLoggedIn=1) group by InstitutionCode) b
on a.InstitutionCode=b.InstitutionCode
--3 得到注册完成员工
update a set a.SubmittedPersion=b.SubmittedPersion from #tempLoggedInAndSubmittedReport a join
(select distinct InstitutionCode,count(1) as SubmittedPersion from Employee where Id in
(select EmployeeId from EnrollmentEmployee where EnrollmentId=@enrollmentId and HasSubmitted=1) group by InstitutionCode) b
on a.InstitutionCode=b.InstitutionCode
--4、返回结果集
select InstitutionCode 机构代码,PersonOfInstitution 机构人数,LoggedInPerson 机构登录人数,SubmittedPersion 机构注册完成人数
from #tempLoggedInAndSubmittedReport order by 机构代码
drop table #tempLoggedInAndSubmittedReport
end

不知道为什么在2012下会报错.

改动如下:

    create table #tempLoggedInAndSubmittedReport
(
-------------报表需求字段-----------------
InstitutionCode nvarchar(50) COLLATE database_default null,--机构代码
PersonOfInstitution int,--机构人数
LoggedInPerson int,--机构登录人数
SubmittedPersion int--机构注册完成人数
-------------报表需求字段-----------------
);

就能正常工作了。

解决SQL Server的cannot resolve the collation conflict问题的更多相关文章

  1. SQL Server, Cannot resolve the collation conflict

    今天遇到一个较为头痛的问题: Cannot resolve the collation conflict between "Chinese_PRC_90_CI_AS" and &q ...

  2. SQL Server 问题之 排序规则(collation)冲突

    一.写在前面 最近公司进行开发环境升级,数据库也准备了一个新的服务器,一切准备好后开始数据迁移,采取的方式为对现有Database(现有服务器Windows Server 2003 + SQL Ser ...

  3. 解决SQL Server管理器无法连接远程数据库Error: 1326错误

    解决SQL Server管理器无法连接远程数据库Error: 1326错误 我们在在使用SQL Server时都会遇到使用SQL Server Management Studio无法连接远程数据库实例 ...

  4. 解决 SQL Server 所有帐号无 sysadmin 权限,且未启用 SQL Server 身份验证,sa 帐号也未启用的问题

    解决 未启用 SQL Server 身份验证 的问题: 1. 运行 regedit,进入注册表编辑器 2. 打开:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Micro ...

  5. 如何解决 SQL Server 中的锁升级所致的阻塞问题

    概要 锁升级为表锁插入转换很多细粒度的锁 (如行或页锁) 的过程.Microsoft SQL Server 动态确定何时执行锁升级.作出决定之前,SQL Server 将特定的扫描,整个事务,并且用于 ...

  6. 解决Sql Server 日志满了,设置收缩

    解决Sql Server 日志满了,设置收缩: --查看文件占用空间 . '文件大小(MB)',* from sysfiles; ALTER DATABASE SpyData SET RECOVERY ...

  7. 怎样解决SQL Server内存不断增加问题

    原文:怎样解决SQL Server内存不断增加问题 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn. ...

  8. Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_100_CI_AS" in the equal to operation.

    ErrorMessage Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" ...

  9. Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_L及由于排序规则不同导致查询结果为空的问题

    报错:Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_L 出错原因: ...

随机推荐

  1. 2015多校.Zero Escape (dp减枝 && 滚动数组)

    Zero Escape Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Tot ...

  2. 基于Windows10安装Ubuntu双系统

    步骤: 1.从Ubuntu的官网上下载Ubuntu的iSO安装包. http://www.ubuntu.com/download/ 我安装的版本是Ubuntu 14.04.3 LTS 64位版本 2. ...

  3. jersey

    http://www.cnblogs.com/bluesfeng/archive/2010/10/28/1863816.html

  4. 总结一下classpath

    今天好好研究了一下Java的classpath,什么是classpath呢?classpath就是我们输入 java xxx 的时候Java执行环境搜索xxx类文件的路径.指定这个路径有两种方式,第一 ...

  5. BZOJ1030——文本生成器

    给你若干给字符串,再给你一个m,问长度是m的字符串中包含给定字符串的数量mod 10007是多少 这个拿过来啥思路也没有,后来还是看了题解,才知道,原来,原来....那个带fail的Trie还可以搞别 ...

  6. sql server 2008 R2 不允许保存更改,您所做的更改要求删除并重新创建以下表

    点击菜单栏 [工具]->[选项] 进入如下界面: 将阻止保存要求重新创建表的更改 的勾去掉即可.

  7. Caffe学习系列(15):添加新层

    如何在Caffe中增加一层新的Layer呢?主要分为四步: (1)在./src/caffe/proto/caffe.proto 中增加对应layer的paramter message: (2)在./i ...

  8. (转)一个JavaWeb项目开发总结

    原文地址:http://www.cnblogs.com/lzb1096101803/p/4907775.html 一.学会如何读一个JavaWeb项目源代码 步骤:表结构->web.xml-&g ...

  9. 二、 显示加载数据过程的JS

  10. Android 异步消息处理机制解析

    Android 中的异步消息处理主要由四个部分组成,Message.Handler.MessageQueue.Looper.下面将会对这四个部分进行一下简要的介绍. 1. Message: Messa ...