Home > Database > Mysql Tutorial > SQL 存储过程

SQL 存储过程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:42:25
Original
1380 people have browsed it

存储过程的优点: 减少了服务器/客户端网络流量 、 更强的安全性 、 代码的重复使用 、 更容易维护、 改进的性能 创建存储过程: USE AdventureWorks2012;GOCREATE PROCEDURE HumanResources.uspGetEmployeesTest2@LastName nvarchar(50),@FirstName nvarcha

存储过程的优点:减少了服务器/客户端网络流量

                                更强的安全性

                                代码的重复使用

                                更容易维护、

                                改进的性能

 

创建存储过程:   

USE AdventureWorks2012; GO CREATE PROCEDURE HumanResources.uspGetEmployeesTest2 @LastName nvarchar(50), @FirstName nvarchar(50) AS SET NOCOUNT ON; SELECT FirstName, LastName, Department FROM HumanResources.vEmployeeDepartmentHistory WHERE FirstName = @FirstName AND LastName = @LastName AND EndDate IS NULL; GO

调用存储过程:

EXECUTE HumanResources.uspGetEmployeesTest2 N'Ackerman', N'Pilar'; -- Or EXEC HumanResources.uspGetEmployeesTest2 @LastName = N'Ackerman', @FirstName = N'Pilar'; GO -- Or EXECUTE HumanResources.uspGetEmployeesTest2 @FirstName = N'Pilar', @LastName = N'Ackerman'; GO

修改存储过程:

ALTER PROCEDURE Purchasing.uspVendorAllInfo @Product varchar(25) AS SQL语句

删除存储过程:

Drop PROCEDURE 存储过程名 GO

 

授予对存储过程的权限

  • 在对象资源管理器中,香港虚拟主机,网站空间,连接到数据库引擎实例,然后展开该实例。

  • Databases, expand the database in which the procedure belongs, and then expand Programmability." data-guid="0158cbcceb3c293bd5955acfa7c791fc">展开“数据库”、过程所属的数据库以及“可编程性”

  • Stored Procedures, right-click the procedure to grant permissions on, and then click Properties." data-guid="40dbfdd1de573d0e523cfa2c1803dfdb">展开“存储过程”,右键单击要针对其授予权限的过程,服务器空间,再单击“属性”

  • Stored Procedure Properties, select the Permissions page." data-guid="49acb59d660e5d41e7f7f94acea1bbcb">在“存储过程属性”中,选择“权限”页。

  • Search." data-guid="3e331683b380d6b67cb1b508df9e6676">若要为用户、数据库角色或应用程序角色授予权限,请单击“搜索”

  • Select Users or Roles, click Object Types to add or clear the users and roles you want." data-guid="08f91cb8536fb458974d87c86f72eab5">在“选择用户或角色”中,单击“对象类型”以添加或清除所需的用户和角色。

  • Browse to display the list of users or roles." data-guid="0f19aa99d2857b84347589a13dc7b8ac">单击”浏览“以显示用户或角色列表。 选择应对其授予权限的用户或角色。

  • Explicit Permissions grid, select the permissions to grant to the specified user or role." data-guid="d75ba7c0bf18f2eab0ad3c801863b306">在“显式权限”网格中,选择要为指定的用户或角色授予的权限。

  • Related labels:
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template