[导入]自己编写一个SQL Server中用的lastindexof函数CREATE FUNCTION dbo.lastindexof (@stringValue as nvarchar(1000), @stringSearch as nvarchar(1000), @startPosition as int = 0)
[导入]自己编写一个SQL Server中用的lastindexof函数
returns int
[导入]自己编写一个SQL Server中用的lastindexof函数
AS
[导入]自己编写一个SQL Server中用的lastindexof函数
BEGIN
[导入]自己编写一个SQL Server中用的lastindexof函数     
DECLARE @lastindex int
[导入]自己编写一个SQL Server中用的lastindexof函数     
SET @lastindex= @startPosition
[导入]自己编写一个SQL Server中用的lastindexof函数     
DECLARE @tempindex int
[导入]自己编写一个SQL Server中用的lastindexof函数     
while (1=1)
[导入]自己编写一个SQL Server中用的lastindexof函数     
begin
[导入]自己编写一个SQL Server中用的lastindexof函数        
SET @tempindex = charindex(@stringSearch@stringValue@lastindex + 1)
[导入]自己编写一个SQL Server中用的lastindexof函数        
if (@tempindex = 0)
[导入]自己编写一个SQL Server中用的lastindexof函数            
break
[导入]自己编写一个SQL Server中用的lastindexof函数        
SET @lastindex = @tempindex
[导入]自己编写一个SQL Server中用的lastindexof函数     
end
[导入]自己编写一个SQL Server中用的lastindexof函数          
[导入]自己编写一个SQL Server中用的lastindexof函数     
RETURN(@lastindex)
[导入]自己编写一个SQL Server中用的lastindexof函数
END
[导入]自己编写一个SQL Server中用的lastindexof函数
[导入]自己编写一个SQL Server中用的lastindexof函数

快乐老鼠Jerry 2007-12-27 16:52 发表评论

文章来源:http://www.cnblogs.com/didasoft/archive/2007/12/27/1017196.html

相关文章:

  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-07-01
  • 2021-08-22
猜你喜欢
  • 2022-03-09
  • 2022-03-02
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案