这个选择是取决于括弧里面的选择方程式,如果里面的方程式所选取的行是有存在的,那运算程式就会执行BEGIN与END之间的方程式。
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE [dbo].[AddUserDefinedParamValue2]
-- Add the parameters for the stored procedure here
@User varchar(13)
,@ModuleID int
,@FileType varchar(32)
,@Template varchar(64)
,@Category varchar(64)
,@Parameter varchar(max)
,@ParamValue varchar(max)
,@ValueDataType varchar(max)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
IF NOT EXISTS(SELECT * FROM dbo.ModuleUserDefinedParamValue
WHERE ModuleID = @ModuleID AND FileType = @FileType AND Template = @Template AND Category = @Category AND Parameter = @Parameter)
BEGIN
INSERT INTO dbo.ModuleUserDefinedParamValue(
ModuleID, FileType, Template, Category, Parameter, ParamValue, ValueDataType, ModBy, ModDate, LastUpdate, LastModBy)
VALUES (@ModuleID, @FileType, @Template, @Category, @Parameter, @ParamValue, @ValueDataType, @User, GETUTCDATE(), GETUTCDATE(), @User)
END
END
GO
怎样?看得懂吗?嘻嘻!
没有评论:
发表评论