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 - 2015-04-07 : 16:43:59
|
HI. I am creating a SP below and it keep saying must declare scalar variable @comments, what am I doing wrong? I have already declared @comments varchar (255)error---> (Msg 137, Level 15, State 2, Procedure CheckPatientComments, Line 26Must declare the scalar variable "@commnets".)thanks. quote: CREATE PROCEDURE [dbo].[CheckPatientComments] (@enc_id varchar(36) OUTPUT, @data_ind CHAR(1) OUTPUT)AS BEGIN DECLARE @comments varchar(255)select @comments= a.comments from allergy_table_ a inner join patient_encounter pe on pe.person_id= a.person_id INNER JOIN person p ON p.person_id = a.person_id where pe.enc_id= @enc_idIF (@commnets <>'' or @comments is not null) --select @comments= 1 select @data_ind= 'Y' select @comments= @comments SET NOCOUNT Off; endGO
|
|
Pasi
Posting Yak Master
166 Posts |
Posted - 2015-04-07 : 16:50:36
|
I think Ijust found out whats wrong. I have a type in word "comments" never mind.. |
|
|
kostya1122
Starting Member
15 Posts |
Posted - 2015-04-08 : 13:36:41
|
CREATE PROCEDURE [dbo].[CheckPatientComments] (@enc_id varchar(36) OUTPUT, @data_ind CHAR(1) OUTPUT)ASBEGINDECLARE@comments varchar(255)select @comments= a.commentsfrom allergy_table_ ainner join patient_encounter pe on pe.person_id= a.person_idINNER JOIN person p ON p.person_id = a.person_idwhere pe.enc_id= @enc_idIF (@commnets <>'' or @comments is not null) ----------------------------- typo you putt @commnets--select @comments= 1 select @data_ind= 'Y'select @comments= @commentsSET NOCOUNT Off; endGO |
|
|
|
|
|