Chinaunix首页 | 论坛 | 博客
  • 博客访问: 493109
  • 博文数量: 23
  • 博客积分: 7960
  • 博客等级: 少将
  • 技术积分: 1345
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-11 04:05
文章分类

全部博文(23)

文章存档

2010年(1)

2009年(2)

2008年(20)

我的朋友

分类: 数据库开发技术

2008-05-26 08:23:41

MS-SQL的charindex函数
2007年01月05日 星期五 下午 04:38

语法:charindex expression1 , expression2 [ , start_location 

返回字符串中指定表达式的起始位置。返回类型:int

参数:expression1 搜索的字符,expression2 被搜的字符,如果没有给定 start_location,而是一个负数或零,则将从 expression2 的起始位置开始搜索。

  SET @strIP='127.1.1.123'
  SET @strSeparator='.'

  SET @strIP=Rtrim(Ltrim(@strIP))
  SET @i=charIndex(@strSeparator,@strIP)--从STRIP起始位置开始搜索"."的起始位置

阅读(2031) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~