I feel like the organization I'm working for has a table for everything, but nothing is joined :-) :-) Logically, I would like to think that the medical record number (MRN) - which is unique for each patient would be somewhere with patient last name and first name, but nope!! So!! Below is the query and it works fine against the database and it works fine in workflow IF I give it a specific MRN to check. Once I update it to the ? so that it will look up based on the number supplied by the user, I get no results, but no error message either. Any thoughts for those of you that know queries and SQL much better than me??? I have tried updating the "parameter" to string/default/integer; tried putting in quotes - all the tricks people have been teaching me along the way :-)
Thank you for your assistance!!
SELECT
substring(pa.med_rec_nbr, patindex('%[^0]%', pa.med_rec_nbr +'.'), LEN(pa.med_rec_nbr)) as [med_rec_nbr],
pe.last_name,
pe.First_name
FROM LSIDW_DATALAKE.dbo.patient pa WITH(NOLOCK)
INNER JOIN LSIDW_DATALAKE.dbo.person pe WITH(NOLOCK)
ON PE.Person_id = PA.Person_id
where med_rec_nbr = ?
**Note - I have also done it without the "locking" info. Our DBA wanted it in there because these tables are constantly being updated.