我今天一直在玩存储过程.我很兴奋,我很容易地选择了它的基本功能. (我也会尽快尝试触发器).
现在,我想知道如何在存储过程文件夹(Programmability – > Stored Procedure)下保存我的SPROC,以便我可以通过名称(最终从我的C#应用程序)访问它.到目前为止,当我按保存图标时,建议保存整个查询.这不是我想要的.
感谢帮忙
解决方法@H_301_8@
您实际上必须运行CREATE PROCEDURE命令,以便存储过程生成.
以下是MSDN页面的一个例子:
USE AdventureWorks;
GO
-- If procedure exists already,drop it
IF OBJECT_ID ( 'HumanResources.uspGetAllEmployees','P' ) IS NOT NULL
DROP PROCEDURE HumanResources.uspGetAllEmployees;
GO
-- Create (or Re-create) the procedure
CREATE PROCEDURE HumanResources.uspGetAllEmployees
AS
SET NOCOUNT ON;
SELECT LastName,FirstName,JobTitle,Department
FROM HumanResources.vEmployeeDepartment;
GO
以下是MSDN页面的一个例子:
USE AdventureWorks; GO -- If procedure exists already,drop it IF OBJECT_ID ( 'HumanResources.uspGetAllEmployees','P' ) IS NOT NULL DROP PROCEDURE HumanResources.uspGetAllEmployees; GO -- Create (or Re-create) the procedure CREATE PROCEDURE HumanResources.uspGetAllEmployees AS SET NOCOUNT ON; SELECT LastName,FirstName,JobTitle,Department FROM HumanResources.vEmployeeDepartment; GO