Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Ramin
Starting Member
26 Posts |
Posted - 2013-12-15 : 20:27:18
|
HI,I am using below code to get patient status as an out put to my form. not sure whats happening but each time I run this its not executing my last "IF" if set to "N" show me N if not show me "Y" but it is by passing my first "IF" condition and jumps to last?The column alerts_ind shows only Y or N in the table patient_status.The table patient_status_mstr show the description of the patient which "discharged". All I want to do is if the patient is flagged with "discharge" the columns "alerts_ind" shows "Y". but something wrong? any help will be great. below is the code.Thanks.!!Alter PROCEDURE GBCheckPatientStatus (@enc_id varchar(36), @data_ind Char(1) OUTPUT)asbegindeclare @alerts_ind char(1);select @alerts_ind =pm.alerts_ind from patient_status_mstr pm inner join patient_status ps on ps.patient_status_id = pm.patient_status_id INNER JOIN patient_encounter pe ON pe.person_id = ps.person_id INNER JOIN person p ON p.person_id = ps.person_id where alerts_ind = @alerts_ind IF @alerts_ind = 'N' select @data_ind= 'N' else select @data_ind= 'Y' SET NOCOUNT Off; endGO |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-16 : 04:00:24
|
your select statement doesnt make anysense. which field will help us to filter results for a given patient? what do you pass through parameter @enc_id ? which field you need to filter it against?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|