A T-SQL Query To Get The Text Between Two Delimiters In SQL Server
ฝัง
- เผยแพร่เมื่อ 11 ก.ย. 2024
- Become a member! / @erikdarlingdata If you like what you see here, you'll love my advanced performance tuning training:
training.erikd... Click here for 50% off a health check: training.erikd...
🎼🎶 Did you ever know that you're my hero? And everything I would like to be? I can fly higher than an eagle, for you are the wind beneath my wings 🎶🎵
I remember when this song first got popular via Bette Midler and I’d hear it on the radio in my mom’s car and I’m pretty sure it’s why I asked for a Walkman for my 8th birthday.
Too much fun, could not resist.
Proper indentation is up to you, I find that to be the hard part 😅
select cast((select replace((select m.text as '*' for xml path('')), N':', '')) as xml).value('text()[2]', 'nvarchar(2048)')
from sys.messages as m
where m.language_id = 1033 and
m.text like N'%:%:%';
You’re a bad man. A bad, bad man 🥰
you can find all the occurrences of my thumbs with the content of this video lol Most of them are pointed upwards.
Woah woah woah how many thumbs are we talking here
@@ErikDarlingData at LEAST 17
Hi. One more idea:
with first_iter as
(
select m.*, first_pos = charindex(':', [text])
from sys.messages m
where 1 = 1
and m.language_id = 1033
and m.[text] like N'%:%:%'
),
second_iter as
(
select fi.*, second_pos = charindex(':', [text], first_pos+1)
from first_iter fi
)
select *,
first_arg = left([text], first_pos-1),
second_arg = substring([text], first_pos+1, second_pos-first_pos-1),
third_arg = substring([text], second_pos+1, len([text]))
from second_iter
Yeah but CTEs are stupid.