登录 注册
当前位置:主页 > 资源下载 > 9 > SQL Server 2005中存储过程的例子

SQL Server 2005中存储过程的例子

  • 更新:2024-07-08 18:05:08
  • 大小:37KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:其它 - 开发技术
  • 格式:TXT

资源介绍

直接执行文件中的语句即可创建存储过程。 CREATE PROCEDURE [createReDealCheck] -- Add the parameters for the stored procedure here AS BEGIN declare @Cur_Error as integer set @Cur_Error = 0 BEGIN TRANSACTION Tran_1 -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; CREATE TABLE [dbo].[ReDealCheck]( [AppplyNo] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [FileType] [varchar](2) COLLATE Chinese_PRC_CI_AS NOT NULL, [remark] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK_ReDealCheck] PRIMARY KEY CLUSTERED ( [AppplyNo] ASC, [FileType] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] set @Cur_Error=@Cur_Error+@@error CREATE NONCLUSTERED INDEX [index_LWMission_MissionProp1_MissionProp2] ON [dbo].[LWMission] ( [MissionProp1] ASC, [MissionProp2] ASC ) INCLUDE ( [MissionID]) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] set @Cur_Error=@Cur_Error+@@error IF (@Cur_Error<>0) begin ROLLBACK TRANSACTION Tran_1 end ELSE begin --ROLLBACK TRANSACTION Tran_1 COMMIT TRANSACTION Tran_1 end END