当没有牵涉到两个不同的数据库时,出现以上错误. 
 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. 基于Windows10安装Ubuntu双系统

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

  2. CK-Editor content.replace

    <s:property value="content.replace('\n\r', '<br/>')" escape="false"/> ...

  3. PYTHON 自动化学习之路

    一.用户交互小程序 username = 'gyc' password = 'gyc' u = input("what is you name?:") p = input(&quo ...

  4. hiho一下 第一百零七周 Give My Text Back(微软笔试题)

    题目1 : Give My Text Back 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 To prepare for the English exam Littl ...

  5. 24 UsageEnvironment使用环境抽象基类——Live555源码阅读(三)UsageEnvironment

    24 UsageEnvironment使用环境抽象基类——Live555源码阅读(三)UsageEnvironment 24 UsageEnvironment使用环境抽象基类——Live555源码阅读 ...

  6. CookieStore之Cookie的获取与保存

    Set<Cookie> allCookies = driver.manage().getCookies(); try { CookieStore cookiestore = new Bas ...

  7. 【GoLang】tcmalloc && jemalloc

    https://www.douban.com/note/512625720/ http://blog.csdn.net/hanxin1987216/article/details/8156010 ht ...

  8. Print Common Nodes in Two Binary Search Trees

    Given two Binary Search Trees, find common nodes in them. In other words, find intersection of two B ...

  9. Ebase Xi The world's best RAD platform.

    Ebase Xi : http://www.ebasetech.com/ The world's best RAD platform. Xi combines browser and mobile a ...

  10. C#读写SQL Server数据库图片

    效果图: 下载链接: http://download.csdn.net/detail/u010312811/9492402 1.创建一个Winform窗体,窗体分为“数据上传”和“数据读取”两部分: ...