解决SQL Server的cannot resolve the collation conflict问题
今天在创建一个存储过程时出现错误提示:
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问题的更多相关文章
- SQL Server, Cannot resolve the collation conflict
		
今天遇到一个较为头痛的问题: Cannot resolve the collation conflict between "Chinese_PRC_90_CI_AS" and &q ...
 - SQL Server 问题之 排序规则(collation)冲突
		
一.写在前面 最近公司进行开发环境升级,数据库也准备了一个新的服务器,一切准备好后开始数据迁移,采取的方式为对现有Database(现有服务器Windows Server 2003 + SQL Ser ...
 - 解决SQL Server管理器无法连接远程数据库Error: 1326错误
		
解决SQL Server管理器无法连接远程数据库Error: 1326错误 我们在在使用SQL Server时都会遇到使用SQL Server Management Studio无法连接远程数据库实例 ...
 - 解决 SQL Server 所有帐号无 sysadmin 权限,且未启用 SQL Server 身份验证,sa 帐号也未启用的问题
		
解决 未启用 SQL Server 身份验证 的问题: 1. 运行 regedit,进入注册表编辑器 2. 打开:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Micro ...
 - 如何解决 SQL Server 中的锁升级所致的阻塞问题
		
概要 锁升级为表锁插入转换很多细粒度的锁 (如行或页锁) 的过程.Microsoft SQL Server 动态确定何时执行锁升级.作出决定之前,SQL Server 将特定的扫描,整个事务,并且用于 ...
 - 解决Sql Server 日志满了,设置收缩
		
解决Sql Server 日志满了,设置收缩: --查看文件占用空间 . '文件大小(MB)',* from sysfiles; ALTER DATABASE SpyData SET RECOVERY ...
 - 怎样解决SQL Server内存不断增加问题
		
原文:怎样解决SQL Server内存不断增加问题 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn. ...
 - 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" ...
 - 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 出错原因: ...
 
随机推荐
- C#利用Web Service实现短信发送(转)
			
通过编程方式实现短信息的发送对很多人来说是一件比较烦杂的事情,目前一般的解决方法是通过计算机和手机的连线,通过可对手机编程的语言编写相关的手机短信息程序来实现,而这种方法对于一般人来说是很难达到的,因 ...
 - 转:利用node压缩、合并js,css,图片
			
1.安装nodejs http://nodejs.org/ 2.安装各自的node package js我用的是UglifyJS github地址:https://github.com/mishoo/ ...
 - linux 下开放端口问题
			
Linux安装Tomcat后本地可以正常访问,可是这时Tomcat还不能被外界访问需要在Linux默认防护墙上打开8080端口 打开 /etc/sysconfig/iptables [root@l ...
 - Effective Java 读书笔记之五 枚举和注解
			
Java1.5中引入了两个新的应用类型家族,新的类为枚举类型,新的接口为注解类型. 一.用enum代替int常量 1.枚举值由一组固定的常量组成合法值的类型. 二.用实例域代替序数 1.不要根据枚举的 ...
 - Android 手势水平监听判断
			
package com.zihao.ui; import com.zihao.R; import android.os.Bundle; import android.app.Activity; imp ...
 - 2.6---找有环链表的开头结点(CC150)
			
public ListNode detectCycle(ListNode head) { ListNode fast = head; ListNode slow = head; int flag = ...
 - Python 2.x闭包(enclosure)中的变量访问&修改
			
http://stackoverflow.com/questions/3190706/nonlocal-keyword-in-python-2-x ---answer---- Python can r ...
 - python 的dict的update 方法的一点诡秘的行为
			
如下: >>> 'a%s'%a 'a{1: 0, 2: 0}' >>> for k,v in a.items(): a.update(k=v) >>&g ...
 - KVC 与 KVO 理解
			
KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解. Key-Value Coding (KVC) KVC,即是指 NSKeyValueCoding,一 ...
 - C# 毕业证书打印《六》
			
整理思路,从新出发. 加载模版 public void loadtemplate(Label lable) { string p_tempateFile = @"fomate.xml&quo ...