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 |
Pasi
Posting Yak Master
166 Posts |
Posted - 2013-12-17 : 14:53:16
|
HI All,I am having trouble bringing "description" column in to my sp and them at the out put. in the ppatient_status_mstr there is a column called “description” which has patient status such as “discharged” “termed collection” etc... How do I use the SP to bring this description into application? I am assigning it to @mytext. I am not sure how to declare “description” in the SP? Every time I use it I get errors like:Msg 4104, Level 16, State 1, Procedure CheckStatus, Line 20The multi-part identifier "pm.alerts_ind" could not be bound.Msg 207, Level 16, State 1, Procedure CheckStatus, Line 40Invalid column name 'description'.Msg 207, Level 16, State 1, Procedure CheckStatus, Line 43Invalid column name 'description'.I want to say if user picks a description from application . show me that description in output. But I am having trouble how to use the description? I am not sure if my “IF” statements are correct either?Appreciate any help! Thanks a bunch!!Here is the procedure ALTER PROCEDURE [dbo].[CheckStatus] (@enc_id varchar(36) OUTPUT, @Mytext varchar(50) OUTPUT, @data_ind Char(1) OUTPUT)AS BEGIN DECLARE@alerts_ind char(1)select @alerts_ind =pm.alerts_ind ,[description] =pm.[description] ---> "I get erors red line" 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 pe.enc_id= @enc_id and pm.patient_status_id in (select patient_status_id from patient_status_mstr pm where p.person_id = ps.person_id and[description] = 'FFS PT TERMED COLLECTION ' or [description] = 'DISCHARGED FROM PRACTICE : NO meds') IF @alerts_ind = 'Y' select @data_ind= 'Y' else select @data_ind= 'N' if [description] = 'FFS PT TERMED COLLECTION #' select @Mytext = 'FFS PT TERMED COLLECTION # ' if [description] = 'DISCHARGED FROM PRACTICE : no meds' select @Mytext = 'DISCHARGED FROM PRACTICE : NO meds' else select @mytext ='' SET NOCOUNT Off; endGO |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|