How to find the Primary & Foreign Keys & How to access tables with String as Parameter
Trackcare 2021.2
Please may I know how to access SQL parameter with string as datatype with NO reference to SQL Table and SQL Column.
Hi Experts,
I have these two clarifications to make:
- I am struggling to understand the process and method of accessing the SQL table with no reference to SQL parameter or Table but string
This is what I tried: Tired to create ERD diagrams and try to extract Primary and Foreign keys to associate, but I cannot in this case
I would like to do something like this
Select * FROM
SQLUser.SS_User SSU
LEFT JOIN SQLUser.CT_Loc CTL ON CTL.CTLOC_Desc = ?? < Cannot find Info here>
WHERE SSUSR_Initials = 'xxxx"
Example:
- Similarly CT_Loc table has
CTLOC_Code
CT_LOC_Desc,
CT_LOC_Hospital_DR->Hosp_Desc
etc – This is a working code
Same as
SELECT * from SQLUser.CT_Hospital CTH
LEFT JOIN SQLUser.PAC_FacilityType PFT ON CTH.HOSP_Desc = PFT.FACIL_Desc
But please may I know how am I supposed to know when table’s primary key / foreign key do not match and doesn’t show any relationship in ERD as below.
But when I extracted the ERD diagram of CT_Loc and CT_ Hospital they do not have any relationship and when I used the rowID, I got wrong answers.
Any detailed explanation will help, with reference to documentation will be appreciated.