![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
CREATE
PROCEDURE
Proc_InsertTemp
(
@number varchar ( 3000 ),
@name varchar ( 2100 ),
@output varchar ( 100 ) output
)
AS
BEGIN
BEGIN TRANSACTION operTran1
SET NOCOUNT ON ;
DECLARE @outputerr varchar ( 3000 )
insert into dbo.Table_1 values ( @number , @name )
if @@error <> 0 or @@rowcount = 0
begin
select @output = ' -1 '
rollback transaction operTran1
return
end
else
begin
COMMIT TRANSACTION operTran1
end
END
(
@number varchar ( 3000 ),
@name varchar ( 2100 ),
@output varchar ( 100 ) output
)
AS
BEGIN
BEGIN TRANSACTION operTran1
SET NOCOUNT ON ;
DECLARE @outputerr varchar ( 3000 )
insert into dbo.Table_1 values ( @number , @name )
if @@error <> 0 or @@rowcount = 0
begin
select @output = ' -1 '
rollback transaction operTran1
return
end
else
begin
COMMIT TRANSACTION operTran1
end
END
表Table_1的结构也很简单:
CREATE
TABLE
[
dbo
]
.
[
Table_1
]
(
[ number ] [ int ] NULL ,
[ value ] [ nvarchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NULL
)
[ number ] [ int ] NULL ,
[ value ] [ nvarchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NULL
)