我每个月都有一组数据要复制和粘贴,但是我需要填写一列,该列从“旧”数据开始一直到新粘贴的数据。因此,我有两组不同的CREATE Function dbo.udf_split( @str varchar(max), @delimiter as varchar(5) )
RETURNS @retTable Table
( RowN int,
value varchar(max)
)
AS
BEGIN
DECLARE @xml as xml
SET @xml = cast(('<X>'+replace(@str,@delimiter ,'</X><X>')+'</X>') as xml)
INSERT INTO @retTable
SELECT RowN = Row_Number() over (order by (SELECT NULL)), N.value('.', 'varchar(MAX)') as value FROM @xml.nodes('X') as T(N)
RETURN
END
值,但是我不确定如何指示其填充范围。
LastRow