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

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - 黑暗之眼

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
)