help me with cross apply with derived field

ASHMITP 141 Reputation points
2022-09-26T22:32:43.997+00:00

Hi ,

Please kindly help me with cross apply with Facility_MRN as I am ussing the case statement with another field to get it.
Help me with the query.

select
CASE WHEN CLIENT_ID IS NOT NULL AND CLIENT_ID <> '' AND CLIENT_ID <> '0000000000' THEN
VIEW_CLINIC_MAPPING.[Location Facility ID] + '-' + [CLIENT_ID]
ELSE
'AUID' + '-' + [CLIENT_ID]
END as [Facility_MRN]
,convert(varchar(50),rtrim(se_Facility_MRN.masked_fact_mrn)) as masked_Facility_MRN
FROM [dbo].[SE] se
CROSS APPLY tvf_mask_facility_mrn(se.Facility_MRN) as se_qr_facilitymrn

Thanks

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,565 questions
{count} votes