tsql LastIndexOf

2908 단어 indexOf
ALTER FUNCTION [dbo].[LastIndexOf] (@stringValue as nvarchar(1000), @stringSearch as nvarchar(1000))

 returns int

AS

BEGIN

     DECLARE @lastindex int

     SET @lastindex= 0

     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

좋은 웹페이지 즐겨찾기