創建函數dbo。FunSplitStringToAraay(@ vch string varchar(1000),@vchSplit varchar(10))
返回@tabArray表
(
字符串varchar(100)
)
如同
開始
DECLARE @intStart int
DECLARE @intLocation int
DECLARE @ vchSubstring varchar(100)
SELECT @intStart =1
SELECT @ int location = CHARINDEX(@ vch split,@vchString,@intStart)
WHILE(@ int location & lt;& gt0 )
開始
SELECT @ vchSubstring = SUBSTRING(@ vchString,@intStart,@intLocation-@intStart)
INSERT INTO @ tab array(string)SELECT @ vch substring
SELECT @ int start = @ int location+1
SELECT @ int location = CHARINDEX(@ vch split,@vchString,@intStart)
結束
返回
結束