设为首页 加入收藏

TOP

sql查询字段中是否包含特定字符代码
2011-06-12 21:31:08 来源: 作者: 【 】 浏览:67次 评论:0

update Survey_QuestionColumns set ColumnPath='1|3|1000|6' where  ColumnPath='1|3|4|6'

CREATE FUNCTION  Spliaaaa
(
@List nvarchar(2000),--要分隔的字符串
@SplitOn nvarchar(5),--分隔符
@num int
)
RETURNS varchar(50)
as
BEGIN
declare @aaa varchar(50)
declare @RtnValue table
(
Id int identity(1,1),
[Value] nvarchar(100)
)
While (Charindex(@SplitOn,@List)>0)
Begin
Insert Into @RtnValue ([Value])
Select
    [Value]= ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1)))
    Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))
End
   Insert Into @RtnValue ([Value])
    Select [Value] = ltrim(rtrim(@List))
   select @aaa=[Value] from @RtnValue where Id=@num-1
    return @aaa
END
go
 select * from Survey_QuestionColumns where   dbo.Spliaaaa(ColumnPath,'|',3)='3'

drop function Spliaaaa

您看到此篇文章时的感受是:
Tags: 责任编辑:administrator
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇mysql Server shutdown in progre.. 下一篇mysql 正则表达式查询与实例

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

相关栏目

最新文章

图片主题

热门文章

推荐文章

相关文章

广告位