在server sql中如何编写存储过程
时间:2021-07-01 10:21:17
帮助过:12人阅读
10),@ClassID varchar(
14))
AS
Begin
if((@ClassID<>
‘‘)and(@ClassID
is not
null))
begin
--
根据班级编号查询学生名单信息 这里写你想写的sql语句
Select StudentID,Name,Sex,ClassCode,SUBSTRING(ClassCode,1,
14)
as ClassID,ClassName,dbo.GetStudyFlagToCh(StudyFlag)
as StudyFlagCaption
from StudentInfoView
where ClassCode like @ClassID+
‘%‘ order by ClassCode
end
else begin
----
根据辅导员编号查询学生名单信息
Select StudentID,Name,Sex,ClassCode,SUBSTRING(ClassCode,1,
14)
as ClassID,ClassName,dbo.GetStudyFlagToCh(StudyFlag)
as StudyFlagCaption
from StudentInfoView A,ClassTutorInfo B
where SUBSTRING(A.ClassCode,
1,
14)=B.ClassID and B.TeacherID =
@TeacherID order by A.ClassCode
end
end
--exec StudentsGetByTutorIDOrClassID
‘0413‘,
‘‘
--exec StudentsGetByTutorIDOrClassID
‘0413‘,
‘20150610020002‘
留作笔记
在server sql中如何编写存储过程
标签:server apt blog sql sid toc class rom view