时间:2021-07-01 10:21:17 帮助过:5人阅读
二.带输入参数
1 IF exists (select * from dbo.sysobjects where id =object_id(N‘[dbo].[sp_Employees_GetById]‘) and OBJECTPROPERTY(id, N‘IsProcedure‘)= 1) 2 BEGIN /*判断数据库中是否已经存在该存储过程*/ 3 DROP PROCEDURE sp_Employees_GetById; 4 END 5 GO 6 CREATE PROCEDURE sp_Employees_GetById 7 ( 8 @LastName varchar(20), 9 @FirstName varchar(20) 10 ) 11 AS 12 BEGIN 13 SELECT TOP 3 * FROM Employees e WHERE e.FirstName = @FirstName AND e.LastName = @LastName; 14 END 15 --执行 16 EXEC sp_Employees_GetById ‘Davolio‘,‘Nancy‘;View Code
SqlServer存储过程基础
标签: