惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - 黑暗之眼

VS2022 过期 VOTT项目迁移 删除MYSQL教程 安装mysql 64位 Smartform给文本绑定值 ABAP的smartform赋值 查源代码中指定字符串 Excel取消保护密码 修改机器名后无法使用复制 COCOS2DX2.2.2 创建CCEditBox输入框架实现文本及密码输入 SSMS 2008R2没有智能感知方法解决 清除SQL Server执行计划 Cocos2D-x搭建新环境注意事项 Cocos2D 指定文件夹创建项目 Cocos2D创建项目 DVDRW光驱无法读DVD刻录盘 Android导入Cocos2D的Sample项目 监控SQL Server的job执行情况 动态调用Web Service
SQL SERVER 强制排序规则查询
黑暗之眼 · 2014-04-23 · via 博客园 - 黑暗之眼

有时会需要在2个DB之间的数据做比较, 但因为一些原因, 数据库的默认排序规则是不一样的, 例如

SELECT A.Col1, B.Col1, A.* FROM DB1.dbo.A LEFT JOIN DB2.dbo.B ON A.Code = B.Code 
WHERE 1 = 1
ORDER BY A.Col2

则会报如下错误:

无法解决 equal to 运算中 "Chinese_PRC_CI_AS" 和 "SQL_Latin1_General_CP1_CI_AS" 之间的排序规则冲突。

注: 红色字体可能会有所不同

这时, 需要我们用指定的排序规则来解决, 添加下面黄底的语句(注: 红色字体需要按实际报错排序规则的来排序)

SELECT A.Col1, B.Col1, A.* FROM DB1.dbo.A LEFT JOIN DB2.dbo.B ON A.Code = B.Code COLLATE SQL_Latin1_General_CP1_CI_AS
WHERE 1 = 1
ORDER BY A.Col2

IN的写法

SELECT Col1, Col2 
FROM Table1 WHERE Code COLLATE SQL_Latin1_General_CP1_CI_AS IN (
SELECT StdItemCode FROM #Temp1
)