将字符串拆分为id

Sql :

alter function [fn_splitSTR]
(
@s varchar(8000), -- 5,6,7
@split varchar(10) -- ','
)
return @re table(col varchar(100))
as
begin
declare @splitlen int
set @splitlen=len(@split+'a ')-2
while charindex(@split,@s)>0
begin
insert @re values(left(@s,charindex(@split,@s)-1))
set @s=stuff(@s,1,charindex(@split,@s)+ @splitlen,' ')
end
insert @re values(@s)
return
end

执行:

select*from dbo.fn_splitSTR('5,6,7',',')

结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAAB1CAIAAABS5yFCAAAGSklEQVR4nO3cS2vbSAAH8PlAy0LRpYZ+hl56MynNSaH9Ci1peuhpSYIhdRjsUhVCtnUMW8wSmhKyTk3bxZolsGzWhpItfaSksptYfsh6JdrD2FM5tvWwR7JkS/wxrpu4+fk/GkmjUHB8XCLJPoNfPh1mn8Hqt7LboJODSQUsLbn+lilgj/JJTQE7anuW2NTanvoMYI9QdegSsSP21GcAWzz78PHtSmX956+//BSKfFm/dvR6WTz7MBb749uV0ydXlJ2rxp/XQhFtL3b65MrHtytjsY+e3lBeXjXeXQtRlJdXj57eeL7zR+LX351kADuRSuv6ReiSSKW/fKsazjZ3bBaigWHYy5kI+6J3y+fz+Xw+17tx3MbFxYVrNkRGJ9Bgh8SaDQCw+CN5ceBmzT4/13Vd13UNB0J0qWRBEFgIdV0bt+3+nhkWMQwFdv/f2rJVVTGHsEVRRFUDVY3NYo1loaoq7tjmz4/nefI8n8/jJ7IsQ4gYhrU1W5c5WtuyLJmDf9pSqYQQ4nl+s1iDELEslGVpdDahGoaRy+WwWRRFCFEsFrM1e9G2JDUlqUECIYII5XI5CBHHbeCwLJSkhjs2x22USiWe5/O9G35rPGFYs/tLo7hvS1JDkuok/fv2ZrGGa3fNHtg2hEgURbwLcdzGMLbZ6VBlTb3EbrXqrZZIAiH6/PmzIAiCICBkbBZrm8XaKAewgYNcluVcLkemDWs2MVt8gfXmin10dNQzJBHCLbljJ5NJhBB+F7Lb4Eey/0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G1FbvuwqBRctqeLSsFlhyg02bM0pcmSLEsRO2LPLJucn45zsW3L3s3M9ZwGd87PJ8UuPOxefo17r9dF24frcbvTchrsdktutxysrsxnS36wM8tzjw59GORO2CXutj9tH67HHSyq+cEub817vW+T7GbmbC+2fR7kni4Y45DFBu/Z7Xaz3W5OeMG4W7XtcpIfbB9vDxygk71HC/aTmU9tk+P2OFU7Yu8vOl8q92+Qj5nAnaXNKBv/V6Ezt6hkZs/QopKZPUOLSmZ2WOL8A7JnU2wjOInYETtizxq7VZda9Yg9VfkfMvpq0OmLSFAAAAAASUVORK5CYII=" alt="" />

上一篇:网络HTTP协议


下一篇:【转载】React初学者入门须知