今天有個老朋友忽然問我一個問題,關於存儲過程的。這個存儲很簡單:
CREATE PROCEDURE Proc_InsertTemp
(@number varchar(3000),
@name varchar(2100),
@output varchar(100) output )
AS
BEGIN
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的結構也很簡單: