Declare @products varchar(200) = 'one::two::tree'
Declare @individual varchar(20) = null
declare @res table(ident int identity(1,1),val varchar(20))
WHILE LEN(@products) > 0
BEGIN
IF PATINDEX('%::%',@products) > 0
BEGIN
SET @individual = SUBSTRING(@products, 0, PATINDEX('%::%',@products))
Insert into @res (val) values (@individual)
SET @products = SUBSTRING(@products, LEN(@individual + ';;') + 1,
LEN(@products))
END
ELSE
BEGIN
SET @individual = @products
SET @products = NULL
Insert into @res (val) values (@individual)
END
END
Select * from @res p
Pivot( max(p.val) for p.ident in ([1],[2],[3]) ) as PIV
Tuesday
ms sql split string into columns
here is excellent example how to split string into columns in TSQL (microsoft SQL server)
Subscribe to:
Post Comments (Atom)
imagemagic add text to image
rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...
-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring&...
-
Perfect blog post must include following elements (from 1 to 13): 1.Big catchy header in 30px font size 2.First copy of social links and com...
-
SetKeyDelay , 75 , 75 ;Exits AutoHotKey application. $^CapsLock:: ExitApp return ;Pauses AutoHotKey Script. F6:: Pause , Toggle, 1 $x:: ...
No comments:
Post a Comment