sql - Stored procedure can't select table -


can please tell me going wrong in this:

i'm getting error on doing this:

create procedure dbo.enrollstudent ( @courseid  integer,                                      @studentid varchar(20),                                       @status varchar(50) output ) begin    declare @stutusid integer     if @stutusid = 1    begin          set @status = 'the student enrolled'    end;     else if @stutusid = 2    begin         set @status = 'cannot enroll until faculty selected'     end     else if @stutusid = 3    begin         set @status = 'student enrolled'     end     if (dbo.courseenrollment.courseid = @courseid ,         dbo.courseenrollment.studentid @studentid)    begin       set @stutusid = 1    end end; 

my error is

msg 4104, level 16, state 1, procedure enrollstudent, line 23
multi-part identifier "dbo.courseenrollment.courseid" not bound.
msg 4104, level 16, state 1, procedure enrollstudent, line 23
multi-part identifier "dbo.courseenrollment.studentid" not bound​

how can select courseenrollment table? i'm not able that.

you can't use column of table without using table:

if exists (select 1 dbo.courseenrollment courseid=@courseid             , studentid '%' + @studentid + '%') begin set @stutusid=1 end 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -