데이터베이스:저장 프로세스

2301 단어 저장 프로세스
        

1.eg:

create procedure student_course

as

select student.Sno ,Sname,Cname,Grade

from Student,Course,SC

where Student.Sno=SC.Sno and Course.Cno=SC.Cno and Sname='  ';

2.         sysobjects    ,     syscomments 

if exists(select name from sysobjects where name='student_course' and type='p')

drop procedure student_course;

/*

p:      

f:    

u:   

v:    

3.      sp_helptext         SQL  ,        sp_depends                                 

             with encryption  ,                    syscomments  。

4.      execute student_course;

5.

create procedure student_course1

@StudentName varchar(10)

as

select Student...

where ...and Sname=@StudentName;



execute student_course1 '  ';

execute student_course1 @StudentName='  ';

       @parameter_name=value  ,              。

6.

create procedure student_count

@CourseName varchar(20),

@StudentSum int output

as

select @StudentSum=count(*)

from ..

where ..and Cname=@CourseName;



declare @studnetNum int

execute student_count '       ',@studentNum output;



select 'the result is:',@studnetNum;

7.  

alter procedure student_course

...

as

...;

8.  

drop procedure student_course;

좋은 웹페이지 즐겨찾기