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
My data
db2
Task2_Final
Task_6_Final
Checking SQL Job run status
Greatest_N_Per_Group
Create Date Batches from Date Range - SQL Server
Loading json file into sql server
Row wise arithmetic operation using pivot and unpivt
social