This forum isn't for solving your programming tasks. But for the fun of it, I've done it for the row number:
create FUNCTION getRow
(
@s varchar(max)
)
RETURNS varchar(4)
AS
BEGIN
DECLARE @Result varchar(4)
declare @ind int
SET @ind = PATINDEX('%R[0-9][0-9][0-9][0-9]%', @s)
if @ind > 0
set @Result = SUBSTRING(@s, @ind + 1, 4)
else begin
SET @ind = PATINDEX('%R[0-9][0-9][0-9]%', @s)
if @ind > 0
set @Result = SUBSTRING(@s, @ind + 1, 3)
else
set @Result = ''
end
RETURN @Result
END
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…