Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
split a string into pairs of words
DECLARE @TourCodes VARCHAR(4000); SET @TourCodes = ' AVG123 , JGH12,AVasfG123,JGsdfH12,AVsdgG123,JsdgGH12 , A34G123,J56gGH12, A34G1df23,JgfGH12'; with rcrs AS ( select rtrim(ltrim(LEFT(@TourCodes,charindex(',',@TourCodes)-1))) first, SUBSTRING(@TourCodes+',',charindex(',',@TourCodes)+1,4000) other, 0 flg union all select rtrim(ltrim(LEFT(other,charindex(',',other)-1))) first, SUBSTRING(other,charindex(',',other)+1,4000) other , flg+1 flg FROM rcrs WHERE charindex(',',other)>0 ) select a.first one,b.first two from rcrs a INNER JOIN rcrs b ON b.flg=a.flg+1 WHERE a.flg%2=0
run
|
edit
|
history
|
help
0
CTE Recursive sample
STDEV vs STDEVP
sadasd
sql
SI 1
how-to-assign-a-random-value-in-a-select-statement-in-sqlserver
tesing
28-02
customers table
identity