存储过程中可以定义输出变量,返回值,执行存储过程还能获得结果集。每个存储过程的默认返回值为0。下面紧接着上文 SQL Server中存储过程Stored Procedure创建及C#调用 基础上写的一个新的Stored Procedure存储过程则包含了输出参数、返回值以及select结果。
USE [db]
GO
/****** Object: StoredProcedure [dbo].[insert_persions] Script Date: 2/25/2015 11:14:11 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF OBJECT_ID ('get_persons','p') IS NOT NULL
DROP PROCEDURE get_persons;
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE get_persons
-- Add the parameters