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

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

博客园 - DiviSoft

出如此错误,同样的代码却能在另一台机器执行(估计是补丁问题 - DiviSoft - 博客园 温习存储过程的CURSOR PHP下的DLL Accesss Denied解决之道 xp下的host文件配置 急:为什么我把本子置为 standby 待机 ,就唤不醒了呢(唤醒我的笔记本) php 安全介绍。。 j#操作EXCEL css 文本输出方式 采用textarea 转载:操作EXCEL .NET JDK在LINUX安装 js for myself 常用JS,HTML对象 smarty 模板 JavaScript类(转载) XML解析问题 php+cookies 使页面里所有大于_width的图片,全部成比例缩小成_width 崚 不能被 iconv(gb2312,utf-8 ,string) DOMDocument for php5
sqlserver in子句的使用?--如何实现CorpIDSet作为ID集合使用,能在存储过程中正确执行如一般SQL效果?
DiviSoft · 2005-06-20 · via 博客园 - DiviSoft


CREATE TABLE [dbo].[tlCorp] (
 [CorpID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,(关键字)//注意,是int
 [CorpName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [CorpIDSet] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL //注意,是varchar
)


 

 CorpID CorpName CorpIDSet
 1  s1   0
 2  s2   1
 3  s3   1
 4  s4   1
 5  s5   1,2
 
使用如下SQL,结果是2 
select count(*) from tlCorp where CorpID in
 (select CorpIDSet from tlCorp where CorpID=5 )

但使用如下(存储过程一部分),放入分析查询器执行,结果却为0,和SQL结果完全不同
select @CorpID=5
select @CorpIDSrc=1
select count(*) from tlCorp where CorpID in
 (select CorpIDSet from tlCorp where CorpID=@CorpID ) and CorpID=@CorpIDSrc

若修改为
select @CorpID=4//修改处
select @CorpIDSrc=1
select count(*) from tlCorp where CorpID in
 (select CorpIDSet from tlCorp where CorpID=@CorpID ) and CorpID=@CorpIDSrc
结果为1

问:如何实现CorpIDSet作为ID集合使用,能在存储过程中正确执行如一般SQL效果?