Created
August 14, 2018 08:57
-
-
Save alaawahbah/47532db2fa0e69563987a793f31ac012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @list varchar(MAX), @i int | |
select @i=0, @list ='4,7,12,22,19,' | |
while( @i < LEN(@list)) | |
begin | |
declare @item varchar(MAX) | |
SELECT @item = SUBSTRING(@list, @i,CHARINDEX(',',@list,@i)-@i) | |
select @item | |
print @item | |
--do your stuff here with @item | |
--exec p_MyInnerProcedure @item | |
set @i = CHARINDEX(',',@list,@i)+1 | |
if(@i = 0) set @i = LEN(@list) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment