Tuesday, February 9, 2016

How to find references to a field in SQL backend

This query will give you a good list of reference on a particular field. You can find all references to it from processes and screens. This requires you to have a SQL backend and a studio to query the database. Replace 'APPLICATIONS.ID' with name of the field you want to find reference.

declare @fieldName as varchar(20) = 'APPLICATIONS.ID'
SELECT PROCESS_NAME as 'Process ID', PROCESS_TYPE as 'Process Type', PROCESS_DIRECT_ACCESS_NAME as 'UI Mnemonic' from PRCS_DEF A left JOIN PRCS_CTL B
ON A.PROCESS_NAME = B.PROCESS_MNEMONIC
where PROCESS_DATA_ELEMENTS like '%'+@fieldName+'%' or
PROCESS_DEMAND_ELEMENTS like '%'+@fieldName+'%' or PROCESS_DEMAND_POINTERS like '%'+@fieldName+'%'
ORDER BY PROCESS_DIRECT_ACCESS_NAME DESC, PROCESS_TYPE 

The result would look something like this: