–创建存储过程
use TestDB
go
if OBJECT_ID(‘GetStudent’,‘P’)IS NOT NULL–判断是否存在存储过程
Drop Procedure GetStudent–如果存在则删除
go
Create Procedure GetStudent–创建存储过程
@SNO INT–查询参数
AS
SELECT *FROM Student WHERE SNO=@SNO
go
–调用
exec TestDB.dbo.GetStudent @SNO=95001