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

推荐订阅源

T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
量子位
Martin Fowler
Martin Fowler
月光博客
月光博客
P
Proofpoint News Feed
博客园_首页
Y
Y Combinator Blog
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
H
Help Net Security
U
Unit 42
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - 馒头

加载安卓SDK失败的办法 WCF服务端配置容易被忽略的细节问题 对 wcf 的安全机制传输安全的疑惑求教 [转].net试用分布式数据库事务com+ [转].net下跨数据分布式事务的处理办法TransactionScope [转]Page的生存周期 [转]如何获得动态添加的html控件的值 - 馒头 - 博客园 如何在客户端清除fileUpLoad控件的文件路径 - 馒头 - 博客园 来自朋友的关爱 T_Sql之Str()和Cast .net word编程对象简介 .Net将数据导出Word Oracle 与SQL Server 2000常用函数对照 [摘抄] 项目中除了需求外还需要知道的问题 .net调用数据库存储过程应当注意的问题 [转]Asp.Net下导出/导入规则的Excel(.xls)文件 [转]常用表达式 [转]ASP.NET提供文件下载函数 [转]项目的成败
如何向存储过程传送数组
馒头 · 2007-03-20 · via 博客园 - 馒头

方案1
Declare @Technic varchar(800)
Declare @CurrentIndex int
Declare @NextIndex int
Declare @TechnicCondtion varchar(1000)

Set @Technic='1,2,3,4,5,6,7,89,10,'
Set @CurrentIndex=1

print len(@Technic)

Set @CurrentIndex=CharIndex(',',@Technic)
Set @NextIndex=CharIndex(',',@Technic,@CurrentIndex+1)

-- Select @CurrentIndex,@NextIndex
-- Select Substring(@technic,@CurrentIndex+1,@NextIndex-@CurrentIndex-1)

Set @TechnicCondtion=' And Technic='+SubString(@Technic,0,@CurrentIndex)

while(@NextIndex<Len(@Technic))
Begin
 Set @NextIndex=CharIndex(',',@Technic,@CurrentIndex+1)
 Print  @NextIndex
 print @CurrentIndex
 Set @TechnicCondtion=@TechnicCondtion+' And Technic='+Substring(@technic,@CurrentIndex+1,@NextIndex-@CurrentIndex-1)
 Set @CurrentIndex=@NextIndex

 
 print @TechnicCondtion
End

Select @TechnicCondtion

方案2

Set TechnicCondtion='In '+SubString(@Technic,Len(@Technic),Len(@Technic)-1)