当没有牵涉到两个不同的数据库时,出现以上错误. 
 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. STM32F103xx bxCAN(Basic Extended CAN) 滤波机制

    一.背景 最近一个项目需要使用STM32F103xx实现CAN通信,而CAN总线的消息滤波在各个MCU上有不同机制, 譬如,SJA1000为标识符位屏蔽滤波机制,NXP的LPC17xx系列为标识符列表 ...

  2. 【C语言入门教程】5.2 函数的作用域规则(auto, static)

    作用域规则是指代码或数据的有效使用范围.C语言将函数作为独立的代码块,函数之间不能相互访问其内部的代码或数据.函数间数据的传递只能通过接口实现.但是,变量的定义方法可改变函数的作用域规则,可将变量分为 ...

  3. Redis Windows下安装部署

    下载Redis 在Redis的官网下载页上有各种各样的版本,我这次是在windows上部署的,要去GitHub上下载.我下载的是2.8.12版的,相信大家百度一下就可以搜到,这就是我们需要的: 启动R ...

  4. Redis优化之CPU充分利用

    Linux Redis Server之CPU充分利用 不知道大家有没有注意到你们公司的集群配置是否是有一种配置是这样的: 多个Redis Server分布在同一个节点,只是端口不同,如果有的话,应该是 ...

  5. Git 常用命令2

    Git 常用命令 Git 是一个很强大的分布式版本控制系统.它不但适用于管理大型开源软件的源代码,管理私人的文档和源代码也有很多优势. Git常用操作命令: 1) 远程仓库相关命令 检出仓库:$ gi ...

  6. 剑指Offer 二叉树中和为某一值的路径(dfs)

    题目描述 输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径.     思路: 递归,然后深搜,因为题目定义的, ...

  7. django的cookie 和session

    Cookie 1.获取cookie: request.COOKIES['key'] request.get_signed_cookie(key, default=RAISE_ERROR, salt=' ...

  8. python编码问题(2)

    先上代码: # -*- coding: utf-8 -*- import sys import urllib2 import re import chardet import sys print sy ...

  9. 【GoLang】GoLang 单元测试、性能测试使用方法

    单元测试代码: ackage test import ( // "fmt" "testing" ) func Test_FlowControl(t *testi ...

  10. Silverlight 中datagrid控件-- 通过设置数据虚拟化加速显示

    定义依赖属性作为datagrid的数据源 protected static readonly DependencyProperty ViewLogsProperty = DependencyPrope ...