20150820 PROCEDURE 模板

USE [DB_H_F1]
GO
/****** Object:  StoredProcedure [dbo].[sp_sys_user_add]    Script Date: 08/19/2015 15:05:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  <Author:HT>
-- Create date: <Create Date:20150819>
-- Description: <Description: user add>
-- =============================================
ALTER PROCEDURE [dbo].[sp_sys_user_add]

   @user_num nvarchar(20),
   @user_name nvarchar(20),
   @user_psd nvarchar(50),
   @create_person nvarchar(20)

AS
BEGIN
   BEGIN TRY
      BEGIN TRANSACTION
     
      SET NOCOUNT ON;
     
      declare @if_efficient nvarchar(10)
      declare @create_time nvarchar(50)

      set @if_efficient = 'Y'
      set @create_time = (select convert(varchar(19),getdate(),120))
   
      insert into sys_user ( user_num, user_name, user_psd, if_efficient, create_person, create_time)
      values (@user_num, @user_name, @user_psd, @if_efficient, @create_person, @create_time)
   
   
   COMMIT TRANSACTION
   END TRY
  
   BEGIN CATCH
        --错误处理
       ROLLBACK
       TRANSACTION
       SELECT ERROR_MESSAGE() --turn warning
   END CATCH
 
END

posted @ 2015-08-20 16:28  追逐苦痛  阅读(120)  评论(0编辑  收藏  举报