-
SQL Server 2005中存储过程的例子
资源介绍
直接执行文件中的语句即可创建存储过程。
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
- 上一篇: SQLSERVER日志分析工具
- 下一篇: SQLEXPRADV_x64_CHS.iso