declare
@bu varchar(300)set
@bu=',0100000011,0100000050,0100000051,0100000026,'create
table #tempmaintable( inpbu varchar(12))DECLARE
@Str NVARCHAR(MAX)SET
@Str = @buDECLARE
@Part NVARCHAR(MAX)DECLARE
@IND INTSET
@IND = CHARINDEX(',',@Str)DECLARE
@EIND INT set @EIND = 0WHILE
(@IND != LEN(@STR))BEGIN
SET @EIND = ISNULL(((CHARINDEX(',', @Str, @IND + 1)) - @IND - 1), 0) insert into #tempmaintable SELECT (SUBSTRING(@Str, (@IND + 1), @EIND)) SELECT @IND = ISNULL(CHARINDEX(',', @STR, @IND + 1), 0)END
select
* from #tempmaintable
No comments:
Post a Comment