if exists(select *from sysobjects where name='p_stu')
drop procedure p_stu
go 
create procedure p_stu
@num int 
as
print '参加'+covert(varchar(5),@num)+'门课考试的学生姓名和学号;'select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num

解决方案 »

  1.   

    if exists(select *from sysobjects where name='p_stu')
    drop procedure p_stu
    go 
    create procedure p_stu
    @num int 
    as
    print '参加'+convert(varchar(5),@num)+'门课考试的学生姓名和学号;'
    select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num
      

  2.   

    select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num這一段語法不對 
      

  3.   

    改改
    if exists(select *from sysobjects where name='p_stu')
    drop procedure p_stu
    go 
    create procedure p_stu
    @num int 
    as
    print '参加'+convert(varchar(5),@num)+'门课考试的学生姓名和学号;'
    SELECT m.MName AS 姓名,学号=m.学号
    FROM Menber AS m
    INNER JOIN score AS s ON m.Mid=s.Mid
    GROUP BY m.MID,m.MName
    HAVING COUNT(*)=@num
      

  4.   

    '参加'+convert(varchar(5),@num)+
      

  5.   


    if exists(select *from sysobjects where name='p_stu')
    drop procedure p_stu
    go  
    create procedure p_stu
    @num int  
    as
    print '参加'+convert(varchar(5),@num)+'门课考试的学生姓名和学号;'  --少了一个n啊
    select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num  
      

  6.   


    if exists(select *from sysobjects where name='p_stu')
    drop procedure p_stu
    go  
    create procedure p_stu
    @num int  
    as
    print '参加'+convert(varchar(5),@num)+'门课考试的学生姓名和学号;'  --convert少了一个n啊
    select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num
    go--最后加上go
      

  7.   

    convert
      

  8.   

    if exists(select *from sysobjects where name='p_stu')
    drop procedure p_stu
    go  
    create procedure p_stu
    @num int  
    as
    print '参加'+convert(varchar(5),@num)+'门课考试的学生姓名和学号;'  --convert少了一个n啊
    select 姓名=(select MName from Menber where Mid=score.Mid), 学号=Mid from score group by Mid having count(*)=@num
    go--最后加上go