SQLTeam.com | Weblogs | Forums

How to print part of the alert message

We have some patients that we the app has an alert like they tend to walk out for example. The alert is like a flag that will appear next to the client name.
The sql is a simple select Full_name, client_alerts from all_clients_secure_view
but the client_alert is stored like "
SO I would only want the piece after title, until the quote end, along with the full_name.

I am not seeing any of the data points you mention in what you posted

Lookup CHARINDEX and SUBSTRING.

it didn't copy over.
You have something like <img src = icons 9/1616 ping on click display client 1405B6...till the word 'title' they all will have title.

please provide the full sample data not partial. otherwise we will be guessing

use three ticks before and after the text you want to post

image

as I see it, we can take the part starting with title and it's not bad.

<img src="icons" onClick="" title="Basic CLient Disruption: 
&#x00;Client is on disruption" />

So I only want to show from Basic.... in my select statement.

declare @junk nvarchar(150) = '<img src="icons" onClick="" title="Basic CLient Disruption: &#x00;Client is on disruption" />'
select @junk as x



select *
 from (select @junk as x ) j
 cross apply DelimitedSplit8K(j.x, '=')

are you allowed to create functions ? if so research DelimitedSplit8K

Functions I am not sure. It is a vendor product.

declare @junk nvarchar(150) = '<img src="icons" onClick="" title="Basic CLient Disruption: &#x00;Client is on disruption" />'
 select substring(@junk, CHARINDEX('title=',@junk,0),len(@junk))

the rest up to you to clean it up
remember parsing string will come back to bite you behind. best to put the data in correctly. where are you getting this data from? Sounds like web page scrapping. Guaranteed this will fail if/when they change the website.

The app is an EHR. We have a reporting server I am using.

and you have no access to the backend of the EHR? is it on prem or sass? No rest api to hit to get the data you want?

select substring(@junk, CHARINDEX('title=',@junk,0) +len('title='),len(@junk)), CHARINDEX('title=',@junk,0)

yes no access to backend they make a reporting db available.