DOTNET开发人生
.NET和C#双剑合璧
posts - 223,  comments - 322,  trackbacks - 11
CREATE FUNCTION dbo.lastindexof (@stringValue as nvarchar(1000), @stringSearch as nvarchar(1000), @startPosition as int = 0)
returns int
AS
BEGIN
     
DECLARE @lastindex int
     
SET @lastindex= @startPosition
     
DECLARE @tempindex int
     
while (1=1)
     
begin
        
SET @tempindex = charindex(@stringSearch@stringValue@lastindex + 1)
        
if (@tempindex = 0)
            
break
        
SET @lastindex = @tempindex
     
end
          
     
RETURN(@lastindex)
END
posted on 2007-12-27 16:52 快乐老鼠Jerry 阅读(798) 评论(2) 编辑 收藏

FeedBack:
2010-01-22 11:34 | uc517      
@startPosition 这个参数的意义能讲讲么
 回复 引用 查看